JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22421
  • Score
    100M100P100Q139540F
  • License MIT

Change permissions of Vinyl files

Package Exports

  • gulp-chmod

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-chmod) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-chmod Build Status

Change permissions of Vinyl files

Install

$ npm install --save-dev gulp-chmod

Usage

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

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

or

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

gulp.task('default', function () {
    gulp.src('src/app.js')
        .pipe(chmod({
            owner: {
                read: true,
                write: true,
                execute: true
            },
            group: {
                execute: true
            },
            others: {
                execute: true
            }
        }))
        .pipe(gulp.dest('dist'));
});

API

chmod(mode)

mode

Type: Number, Object

Can either be a chmod mode number or an object with the individual permissions specified.

Values depends on the current file, but these are the possible keys:

{
    owner: {
        read: true,
        write: true,
        execute: true
    },
    group: {
        read: true,
        write: true,
        execute: true
    },
    others: {
        read: true,
        write: true,
        execute: true
    }
}

When read, write and execute are same, you can simplify the object:

{
    read: true
}

Tip

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

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

var filter = gFilter('src/cli.js');

gulp.task('default', function () {
    gulp.src('src/*.js')
        // filter a subset of the files
        .pipe(filter)
        // make them executable
        .pipe(chmod(755))
        // bring back the previously filtered out files
        .pipe(filter.restore())
        .pipe(gulp.dest('dist'));
});

License

MIT © Sindre Sorhus