isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 148 forks source link

Do not depend on deprecated 'constants' module #206

Open kt3k opened 3 years ago

kt3k commented 3 years ago

constants module has been deprecated since v6.3.0 (ref: https://nodejs.org/api/deprecations.html#DEP0008 ). This PR updates the use of constants to fs.constants.

BTW fs.constants doesn't inherit from Object.prototype (ref: https://github.com/nodejs/node/pull/10458 ), so I updated constants.hasOwnProperty('O_SYMLINK') to constants.O_SYMLINK !== undefined. (This change was discussed in node.js repository https://github.com/nodejs/node/pull/10458#discussion_r93860956 )

aminya commented 3 years ago

fs-extra is broken and cannot be bundled because of this.

anthonyborell commented 3 years ago

@isaacs Would be great if you could take a look at this. As per https://nodejs.org/api/deprecations.html#DEP0008

The constants module is deprecated. When requiring access to constants relevant to specific Node.js builtin modules, developers should instead refer to the constants property exposed by the relevant module. For instance, require('fs').constants and require('os').constants.