Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Change permissions of Vinyl files

License

NotificationsYou must be signed in to change notification settings

sindresorhus/gulp-chmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Change permissions ofVinyl files

Install

npm install --save-dev gulp-chmod

Usage

importgulpfrom'gulp';importchmodfrom'gulp-chmod';exportdefault()=>(gulp.src('src/app.js').pipe(chmod(0o755)).pipe(gulp.dest('dist')));

or

importgulpfrom'gulp';importchmodfrom'gulp-chmod';exportdefault()=>(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 achmod 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}}

Whenread,write, andexecute are the same, you can simplify the object:

{read:true}

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

directoryMode

Type:true | number | object

Same asfileMode, but applies to directories.

Specifytrue to use the same value asfileMode.

Tip

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

importgulpfrom'gulp';importchmodfrom'gulp-chmod';importgulpFilterfrom'gulp-filter';constfilter=gulpFilter('src/cli.js',{restore:true});exportdefault=()=>(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


[8]ページ先頭

©2009-2025 Movatter.jp