Skip to content

jamesj2/gulp-chown

 
 

Repository files navigation

gulp-chown Build Status

Change permissions of Vinyl files

Install

$ npm install --save-dev gulp-chown

Usage

var gulp = require('gulp');
var chown = require('gulp-chown');

gulp.task('default', function () {
	return gulp.src('src/app.js')
		.pipe(chown('sindresorhus'))
		.pipe(gulp.dest('dist'));
});

or

var gulp = require('gulp');
var chown = require('gulp-chown');

gulp.task('default', function () {
	return gulp.src('src/app.js')
		.pipe(chown(501))
		.pipe(gulp.dest('dist'));
});

API

chown(userId, groupId)

Arguments must be of the same type.

userId

Required
Type: string, number

The user name or user id to change ownership to.

userId

Type: string, number

The group name or group id to change ownership to.

Tip

Combine it with gulp-filter to only change ownership of a subset of the files.

var gulp = require('gulp');
var gFilter = require('gulp-filter');
var chown = require('gulp-chown');

var filter = gFilter('src/vendor-*.js');

gulp.task('default', function () {
	return gulp.src('src/*.js')
		// filter a subset of the files
		.pipe(filter)
		// change ownership of them
		.pipe(chown('sindresorhus'))
		// bring back the previously filtered out files
		.pipe(filter.restore())
		.pipe(gulp.dest('dist'));
});

License

MIT © Sindre Sorhus

About

Change ownership of Vinyl files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%