process.umask(mask): void
Attributes
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.
import { umask } from 'node:process'; const newmask = 0o022; const oldmask = umask(newmask); console.log( `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`, );
const { umask } = require('node:process'); const newmask = 0o022; const oldmask = umask(newmask); console.log( `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`, );
In Worker threads, process.umask(mask) will throw an exception.