max-mapper / extract-zip

Zip extraction written in pure JavaScript. Extracts a zip into a directory.
BSD 2-Clause "Simplified" License
391 stars 127 forks source link

Stop using process.umask() #95

Closed aduh95 closed 4 years ago

aduh95 commented 4 years ago

Refs: https://github.com/nodejs/node/issues/32321

Summary: process.umask() (no args) is deprecated and will be removed.

I couldn't quite divine what this lib uses process.umask() for but in most cases you don't need to deal with the umask directly - the operating system will apply it automatically.

Example:

const mode = 0o777 & ~process.umask();
fs.mkdirSync(dir, mode);

Computing the file mode that way is superfluous, it can be replaced with just this:

fs.mkdirSync(dir, 0o777);
malept commented 4 years ago

🤷‍♂️ This is the commit that introduced it: https://github.com/maxogden/extract-zip/commit/6ad307a5cdf8a472b84f10d0fcee299e5c6e4f6e