promisify-node is a utility library designed to convert Node.js callback-style functions, methods, or entire modules into functions that return Promises. The current stable version is 0.5.0, though the project appears to be in an abandoned state with the last significant update in June 2020. Its primary differentiator is the ability to recursively wrap entire modules, automatically identifying asynchronous functions, and the option to wrap methods on objects either in-place or returning a new, non-mutated object. It uses an internal Promise implementation (or relies on a polyfill if not natively available) via `nodegit-promise` in older versions. Given its inactivity, users should be cautious about long-term support or compatibility with modern Node.js features like native ESM.
npm install promisify-nodeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to promisify an entire Node.js module (like 'fs') and a standalone callback-style function, then use their promise-returning interfaces.
To prevent mutation, use `const nonMutatingPromisified = promisify(originalObj, undefined, true);`
Evaluate alternatives like `util.promisify` (built into Node.js since v8.0.0) for active maintenance and better compatibility. If using this package, be aware of its unmaintained status.
Always test the promisified functions thoroughly. For specific functions, it might be safer to manually wrap them or use Node.js's built-in `util.promisify` on individual functions, which requires explicit identification.
Ensure the function passed to `promisify` strictly follows the Node.js error-first callback signature. For synchronous functions, no promisification is needed, as they return values directly.
Verify that the function you are trying to promisify is indeed an asynchronous, callback-style function. Debug the `promisify` call to ensure it returns a Promise. If wrapping an object, confirm the method was replaced as expected.
No dependency data recorded yet.