Change Mode
Path:
/src/method/chmods.coffeecompiled to/lib/method/chmods.js
Change the files mode bits consisting of the file permission bits plus the set-user-ID, set-group-ID, and sticky bits.
The options object is the same as used forFind Files with the additional mode:
mode-Integer- to be set on the matching entriesdereference-Booleandereference symbolic links and go into themìgnoreErrors-Booleango on and ignore IO errors
The file mode is a bit mask with the following bits (octal notation):
| Name | BIT | Description |
|---|---|---|
| SUID | 04000 | set process effective user ID |
| SGID | 02000 | set process effective group ID |
| SVTX | 01000 | sticky bit |
| RUSR | 00400 | read by owner |
| WUSR | 00200 | write by owner |
| XUSR | 00100 | execute/access by owner |
| RGRP | 00040 | read by group |
| WGRP | 00020 | write by group |
| XGRP | 00010 | execute/access by group |
| ROTH | 00004 | read by others |
| WOTH | 00002 | write by others |
| XOTH | 00001 | execute/access by others |
To change the file mode you have to be privileged to do so.
chmods()
Usage:
chmods(source, options, cb)
- Parameter
-
source-Stringfile path or directory to searchoptions-Objectselection of files to search and change modecb-function(Error)callback with error if something went wrong- No file to change mode for found!
chmodsSync()
Usage:
chmodsSync(source, options)
- Parameter
-
source-Stringfile path or directory to searchoptions-Objectselection of files to search and mode
- Throws
-
Errorif something went wrong- No file to change mode for found!