Problem
Now node-fs-ext overrides fs module, i.e. adds new constants to it. Because Node.js modules are cached, other modules got implicitly redefined fs module.
Also, since Node.js 11 constants are not extensible anymore #76 and deprecated since Node.js 6. So, there is no way to get them in new versions of Node.js (only import binding file directly).
Proposal
Instead node-fs-ext can export own constants and doesn't touch core fs module:
const {fcntl, constants} = require('fs-ext');
fs.fcntl(fd, constants.F_SETLK, constants.F_WRLCK, (err) => { ... });
Related Issues
#81
Problem
Now
node-fs-extoverridesfsmodule, i.e. adds new constants to it. Because Node.js modules are cached, other modules got implicitly redefinedfsmodule.Also, since Node.js 11
constantsare not extensible anymore #76 and deprecated since Node.js 6. So, there is no way to get them in new versions of Node.js (only import binding file directly).Proposal
Instead
node-fs-extcan export ownconstantsand doesn't touch corefsmodule:Related Issues
#81