gulp-chown

    2.0.0 • Public • Published

    gulp-chown Build Status

    Change owner of Vinyl files

    Install

    $ npm install --save-dev gulp-chown
    

    Usage

    const gulp = require('gulp');
    const chown = require('gulp-chown');
     
    gulp.task('default', () =>
        gulp.src('src/app.js')
            .pipe(chown('sindresorhus'))
            .pipe(gulp.dest('dist'))
    );

    or

    const gulp = require('gulp');
    const chown = require('gulp-chown');
     
    gulp.task('default', () =>
        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.

    groupId

    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.

    const gulp = require('gulp');
    const gFilter = require('gulp-filter');
    const chown = require('gulp-chown');
     
    const filter = gFilter('src/vendor-*.js');
     
    gulp.task('default', () =>
        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'))
    );

    Related

    License

    MIT © Sindre Sorhus

    Install

    npm i gulp-chown

    DownloadsWeekly Downloads

    214

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • sindresorhus