Server IP : 127.0.0.2 / Your IP : 3.148.231.72 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/nodejs/npm/node_modules/umask/ |
Upload File : |
# umask Convert umask from string <-> number. ## Installation & Use ``` $ npm install -S umask var umask = require('umask'); console.log(umask.toString(18)); // 0022 console.log(umask.fromString('0777')) // 511 ``` ## API ### `toString( val )` Converts `val` to a 0-padded octal string. `val` is assumed to be a Number in the correct range (0..511) ### `fromString( val, [cb] )` Converts `val` to a Number that can be used as a umask. `val` can be of the following forms: * String containing octal number (leading 0) * String containing decimal number * Number In all cases above, the value obtained is then converted to an integer and checked against the legal `umask` range 0..511 `fromString` can be used as a simple converter, with no error feedback, by omitting the optional callback argument `cb`: ``` var mask = umask.fromString(val); // mask is now the umask descibed by val or // the default, 0022 (18 dec) ``` The callback arguments are `(err, val)` where `err` is either `null` or an Error object and `val` is either the converted umask or the default umask, `0022`. ``` umask.fromString(val, function (err, val) { if (err) { console.error("invalid umask: " + err.message) } /* do something with val */ }); ``` The callback, if provided, is always called **synchronously**. ### `validate( data, k, val )` This is a validation function of the form expected by `nopt`. If `val` is a valid umask, the function returns true and sets `data[k]`. If `val` is not a valid umask, the function returns false. The `validate` function is stricter than `fromString`: it only accepts Number or octal String values, and the String value must begin with `0`. The `validate` function does **not** accept Strings containing decimal numbers. # Maintainer Sam Mikes <smikes@cubane.com> # License MIT