Creating a Node.js Library that Supports Both Promises and Error-First Callbacks
suggest changeIntroduction
Many people prefer promises or async/await, but a module can still support error-first callbacks. Rather than publishing two modules, or making every caller promisify the API, return a promise and also accept an optional node-style callback. Bluebird's asCallback() and Q's nodeify() both do that. Node.js callbacks are error-first: the first argument is an error or null.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents