{"library":"nodeify","title":"Nodeify: Promise to Node Callback Converter","description":"Nodeify is a compact utility designed to convert Promise/A+-compliant promises into Node.js-style callback invocations. It allows developers to seamlessly integrate promise-based asynchronous operations into existing callback-driven codebases. The package offers several usage patterns: a direct functional approach, a `nodeify.Promise` constructor that returns promises with a `.nodeify` method, and various `extend` methods to add the `.nodeify` method to existing promise constructors or instances. The current stable version is 1.0.1. Due to its last publish date over seven years ago and no recent activity, the package is considered abandoned. For modern Node.js development, built-in features like `util.promisify` or native `async/await` are the preferred and more robust solutions for handling asynchronous operations and bridging between promises and callbacks.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install nodeify"],"cli":null},"imports":["import nodeify from 'nodeify'","import { Promise } from 'nodeify'; // For ESM\nconst Promise = require('nodeify').Promise; // For CJS","import { extend } from 'nodeify'; // For ESM\nconst extend = require('nodeify').extend; // For CJS"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import nodeify from 'nodeify';\n\n// Simulate an async operation that returns a Promise\nfunction myPromiseMethod(arg) {\n  return new Promise((resolve, reject) => {\n    setTimeout(() => {\n      if (arg > 0) {\n        resolve(`Processed: ${arg}`);\n      } else {\n        reject(new Error('Argument must be positive'));\n      }\n    }, 100);\n  });\n}\n\n// Example 1: Using nodeify with a callback\nfunction myAsyncMethodWithCallback(arg, callback) {\n  return nodeify(myPromiseMethod(arg), callback);\n}\n\nmyAsyncMethodWithCallback(5, (err, result) => {\n  if (err) {\n    console.error('Callback Error:', err.message);\n  } else {\n    console.log('Callback Result:', result);\n  }\n});\n\nmyAsyncMethodWithCallback(-1, (err, result) => {\n  if (err) {\n    console.error('Callback Error (negative arg):', err.message);\n  } else {\n    console.log('Callback Result (negative arg):', result);\n  }\n});\n\n// Example 2: Using nodeify without a callback returns the original promise\nconst promiseOnly = myAsyncMethodWithCallback(10);\npromiseOnly.then(res => console.log('Promise-only Result:', res)).catch(err => console.error('Promise-only Error:', err.message));\n","lang":"javascript","description":"Demonstrates `nodeify` converting a promise-based function to one that supports a Node.js-style callback, returning the promise if no callback is provided.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}