gulp-chmod

WebJar for gulp-chmod

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

gulp-chmod
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

gulp-chmod
WebJar for gulp-chmod
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/gulp-chmod

Download gulp-chmod

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/gulp-chmod/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>gulp-chmod</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-chmod/
implementation 'org.webjars.npm:gulp-chmod:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/gulp-chmod/
implementation ("org.webjars.npm:gulp-chmod:2.0.0")
'org.webjars.npm:gulp-chmod:jar:2.0.0'
<dependency org="org.webjars.npm" name="gulp-chmod" rev="2.0.0">
  <artifact name="gulp-chmod" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='gulp-chmod', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "gulp-chmod" % "2.0.0"
[org.webjars.npm/gulp-chmod "2.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : deep-assign jar [1.0.0,2)
org.webjars.npm : stat-mode jar [0.2.0,0.3)
org.webjars.npm : through2 jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

gulp-chmod

Change permissions of Vinyl files

Install

$ npm install --save-dev gulp-chmod

Usage

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

exports.default = () => (
	gulp.src('src/app.js')
		.pipe(chmod(0o755))
		.pipe(gulp.dest('dist'))
);

or

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

exports.default = () => (
	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(fileMode, directoryMode?)

fileMode

Type: number | object

Can either be a chmod octal 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 the same, you can simplify the object:

{
	read: true
}

Pass undefined to not set permissions on files. Useful if you only want to set permissions on directories.

directoryMode

Type: true | number | object

Same as fileMode, but applies to directories.

Specify true to use the same value as fileMode.

Tip

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

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

const filter = gFilter('src/cli.js', {restore: true});

exports.default = () => (
	gulp.src('src/*.js')
		// Filter a subset of the files
		.pipe(filter)
		// Make them executable
		.pipe(chmod(0o755))
		// Bring back the previously filtered out files
		.pipe(filter.restore)
		.pipe(gulp.dest('dist'))
);

Related

Versions

Version
2.0.0
1.2.0