process.umask(mask)
process.umask(mask)
设置 Node.js 进程的文件模式创建掩码。
子进程从父进程继承掩码。
返回上一个掩码。
const newmask = 0o022;
const oldmask = process.umask(newmask);
console.log(
`Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`
);
在 Worker
线程中,process.umask(mask)
会抛出异常。
process.umask(mask)
sets the Node.js process's file mode creation mask. Child
processes inherit the mask from the parent process. Returns the previous mask.
const newmask = 0o022;
const oldmask = process.umask(newmask);
console.log(
`Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`
);
In Worker
threads, process.umask(mask)
will throw an exception.