{"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist-tags":{"latest":"1.2.1"},"author":{"name":"Matt Andrews"},"description":"Tool to turn functions with Node-style callback APIs into functions that return Promises","readme":"denodeify [ ![Codeship Status for matthew-andrews/denodeify](https://codeship.io/projects/02ac77d0-1a58-0132-bf86-4a07366ee29d/status)](https://codeship.io/projects/34622)\n=========\n\nTool to turn functions with Node-style callback APIs into functions that return [Promises](https://github.com/jakearchibald/es6-promise).\n\nInspired by and adapted from Q's [`Q.denodeify`/`Q.nfcall` function](https://github.com/kriskowal/q/wiki/API-Reference#qnfbindnodefunc-args).\n\nWarning: This micro-library doesn't force you to use any particular Promise implementation by using whatever `Promise` has been defined as globally.  This is so that you may use any ES6 standard Promise compliant library - or, of course, native ES6 Promises.\n\nIf you're running the code on a browser or node version that doesn't include native promises you will need to include a polyfill.  The following polyfills are tested as part of this module's test suite:-\n- [Jake Archibald](https://twitter.com/jaffathecake)'s [ES6 Promise library](https://github.com/jakearchibald/es6-promise) (which is actually adapted from [Stefan Penner](https://twitter.com/stefanpenner)'s [RSVP.js](https://github.com/tildeio/rsvp.js)). -  `require('es6-promise').polyfill();`\n- [Getify](https://twitter.com/getify)'s [Native Promise Only library](https://github.com/getify/native-promise-only) - `require('native-promise-only');`\n- [ES6 Shim](https://github.com/es-shims/es6-shim) - `require('es6-shim');`\n- [Calvin Metcalf](https://twitter.com/CWMma)'s [Lie](https://github.com/calvinmetcalf/lie) - `global.Promise = global.Promise || require('lie');`\n\nNote: as of v1.2.0 you can use **denodeify** in the front end.  Pull it in via CommonJS, AMD or simply add to your webpage and it'll be available on `window.denodeify`. \n\n## Installation\n\n```\nnpm install denodeify --save\n```\n\nOr:-\n\n```\nbower install denodeify --save\n```\n\n## Examples\n\nSimple example with [`readFile`](https://www.npmjs.org/package/read-file):-\n\n```js\nrequire('es6-promise').polyfill();\n\nvar denodeify = require('denodeify');\nvar readFile = denodeify(require('fs').readFile);\n\nreadFile('my-file.txt', { encoding: 'UTF-8' })\n  .then(function(text) {\n    console.log(\"My file's contents is: \" + text);\n  });\n```\n\n(Note: you will need to also install [es6-promise](https://github.com/jakearchibald/es6-promise) with `npm install es6-promise` for this code sample to work within node versions that don't have `Promise` natively available)\n\nMore complex example with `exec`:-\n\n## Advanced usage\n\nYou can also pass in a function as a second argument of `denodeify` that allows you to manipulate the data returned by the wrapped function before it gets passed to the Promise's `reject` or `resolve` functions, for example:-\n\n```js\nrequire('es6-promise').polyfill();\n\nvar denodeify = require('denodeify');\nvar exec = denodeify(require('child_process').exec, function(err, stdout, stderr) {\n\n  // Throw away stderr data\n  return [err, stdout];\n});\n\nexec('hostname')\n  .then(function(host) {\n    console.log(\"My hostname is: \" + host.replace('\\n', ''));\n  });\n```\n\nOr,\n\n```js\nrequire('es6-promise').polyfill();\n\nvar denodeify = require('denodeify');\nvar exec = denodeify(require('child_process').exec, function(err, stdout, stderr) {\n  return [err, [stdout, stderr]];\n});\n\nexec('my-command')\n  .then(function(results) {\n    console.log(\"stdout is: \" + results[0]);\n    console.log(\"stderr is: \" + results[1]);\n  });\n```\n\nUseful for functions that return multiple arguments, for example [`child_process#exec`](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback).\n\n## Credits and collaboration ##\n\nThe lead developer of **denodeify** is [Matt Andrews](http://twitter.com/andrewsmatt) at FT Labs with much help and support from [Kornel Lesiński](https://twitter.com/pornelski). All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions.  Please feel free to raise an issue or pull request.\n","repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"users":{"moimikey":true,"kornel":true,"lshearer":true,"antixrist":true,"grabantot":true,"tomi77":true},"bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"license":"MIT","versions":{"1.0.0":{"name":"denodeify","version":"1.0.0","description":"denodeify [ ![Codeship Status for matthew-andrews/denodeify](https://codeship.io/projects/02ac77d0-1a58-0132-bf86-4a07366ee29d/status)](https://codeship.io/projects/34622) =========","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha && ./node_modules/.bin/jshint"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","jshint":"^2.5.5","mocha":"^1.21.4"},"gitHead":"cae0774899ac4279acb48015d8f1eb825220a32c","_id":"denodeify@1.0.0","_shasum":"9459b981061cb789a98b5699b05948ec064cdd6e","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"9459b981061cb789a98b5699b05948ec064cdd6e","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.0.0.tgz","integrity":"sha512-nYs38StChlnNcL8i/APz8WJHaAKbQ6qBRKFthWgRa7erBoNc1FvmdGL263EGxVe+HluMPnr75dueBBDInsTc+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFMCbxeRsx8VfWDWVKPyFhT9OY90OeTCs0xDfIP50gd2AiB1tdW/liJrEFxmtkiYqOkApzaPFAkeN63VWhlLHIiovw=="}]}},"1.1.0":{"name":"denodeify","version":"1.1.0","description":"Tool to wrap functions with Node style APIs","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha && ./node_modules/.bin/jshint"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","jshint":"^2.5.5","mocha":"^1.21.4"},"gitHead":"31be71ac9e6144ed176ba106c85f60d278b4ceef","_id":"denodeify@1.1.0","_shasum":"7f08d342a5de8cc77c4596d367fd21b3bb2547c0","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"7f08d342a5de8cc77c4596d367fd21b3bb2547c0","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.1.0.tgz","integrity":"sha512-6AFvV2QMvUTYhymOpuydhmhPx/Jy5O2fzponx8mM/Y736DOB4+u2yE0IZqMKpnsSuiMsUXc/kaGRsiBZCG6LWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICN85plLIBGUnQGMG7+1sqaFeJNOtt5HvBSvZHKTB4RUAiEAwPYVVVOTgX4NlAuHNgKWgr1Pz0w5hSH9sDApA5Ok3JA="}]}},"1.1.1":{"name":"denodeify","version":"1.1.1","description":"Tool to turn functions with Node-style callback APIs into functions that return Promises","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha test/*test.js && ./node_modules/.bin/jshint `find . -name '*.js' ! -path './node_modules/*'`"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","es6-shim":"^0.18.0","jshint":"^2.5.5","lie":"^2.7.7","mocha":"^1.21.4","native-promise-only":"^0.7.6-a"},"_id":"denodeify@1.1.1","_shasum":"938110fdbc158250c0ef7bec7252717701a4182d","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"938110fdbc158250c0ef7bec7252717701a4182d","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.1.1.tgz","integrity":"sha512-0/Umyl34QToNi3cHSCvyyM52+lvzObtrnaUfZC+ZVBZQ9HXPSt4tsW9ZPdYc2PFneV0K84H9qirn41uaGxbwww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6vQmX68as9m0OidvUWwDQWjLMm7S3XVvC0T0AqDaxBAiEAlPsJoqWordJkzEY+Kv+Ilf/TP4JQb0vQptl5djlZgss="}]}},"1.1.2":{"name":"denodeify","version":"1.1.2","description":"Tool to turn functions with Node-style callback APIs into functions that return Promises","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha test/*test.js && ./node_modules/.bin/jshint `find . -name '*.js' ! -path './node_modules/*'`"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","es6-shim":"^0.18.0","jshint":"^2.5.5","lie":"^2.7.7","mocha":"^1.21.4","native-promise-only":"^0.7.6-a"},"_id":"denodeify@1.1.2","_shasum":"e3ee239ca5a4ac74f8584b9ad82d19cf30bd1f9c","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"e3ee239ca5a4ac74f8584b9ad82d19cf30bd1f9c","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.1.2.tgz","integrity":"sha512-b9xyqLzgLpbx3v2dhd16sVLfttzAPX4dH1EowQ3aCw5gm+sRyfbYhAgbBSmxJiU2uBoKn7C8JcKFSAi2eCHueQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAyKnqr4WVCZSZpput9gsuykWFiEeFrZaEfP4SVfNfyiAiBBsKmRHHoVcHSDM4LWE2utLRpEH0jULJae/UJn1YAwOA=="}]}},"1.2.0":{"name":"denodeify","version":"1.2.0","description":"Tool to turn functions with Node-style callback APIs into functions that return Promises","main":"index.js","directories":{"test":"test"},"scripts":{"files":"find . -name '*.js' ! -path './node_modules/*'","jshint":"jshint `npm run -s files`","lintspaces":"lintspaces -i js-comments -e .editorconfig `npm run -s files`","test":"mocha test/*test.js && npm run jshint && npm run lintspaces"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","es6-shim":"^0.18.0","jshint":"^2.5.5","lie":"^2.7.7","lintspaces-cli":"0.0.4","mocha":"^1.21.4","native-promise-only":"^0.7.6-a"},"_id":"denodeify@1.2.0","_shasum":"c90add34824844e4cd65937b6c8824aa1af66856","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"c90add34824844e4cd65937b6c8824aa1af66856","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.2.0.tgz","integrity":"sha512-jGYqJPmecE52uzZkLhg9ZLqri8ILt21dnfQa3LJeuCkNfOvj1QEa6+16IXctCHguHUDTB5E5nH1k9zWAKrKYyw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDk3128Zx0WAqw06j6LuUWmN2zXDBQloguBoY3MHYr3ogIgfnlVfndvhruKjqiEg/Vao6hTVXPj+scH0GAMYmlfKlg="}]}},"1.2.1":{"name":"denodeify","version":"1.2.1","description":"Tool to turn functions with Node-style callback APIs into functions that return Promises","main":"index.js","directories":{"test":"test"},"scripts":{"files":"find . -name '*.js' ! -path './node_modules/*'","jshint":"jshint `npm run -s files`","lintspaces":"lintspaces -i js-comments -e .editorconfig `npm run -s files`","test":"mocha test/*test.js && npm run jshint && npm run lintspaces"},"repository":{"type":"git","url":"https://github.com/matthew-andrews/denodeify.git"},"author":{"name":"Matt Andrews"},"license":"MIT","bugs":{"url":"https://github.com/matthew-andrews/denodeify/issues"},"homepage":"https://github.com/matthew-andrews/denodeify","devDependencies":{"es6-promise":"^1.0.0","es6-shim":"^0.18.0","jshint":"^2.5.5","lie":"^2.7.7","lintspaces-cli":"0.0.4","mocha":"^1.21.4","native-promise-only":"^0.7.6-a"},"gitHead":"e500054eb336c748264507e9553af949981ee2c3","_id":"denodeify@1.2.1","_shasum":"3a36287f5034e699e7577901052c2e6c94251631","_from":".","_npmVersion":"2.1.14","_nodeVersion":"0.10.33","_npmUser":{"name":"anonymous","email":"matt@mattandre.ws"},"maintainers":[{"name":"anonymous","email":"matt@mattandre.ws"}],"dist":{"shasum":"3a36287f5034e699e7577901052c2e6c94251631","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/denodeify/-/denodeify-1.2.1.tgz","integrity":"sha512-KNTihKNmQENUZeKu5fzfpzRqR5S2VMp4gl9RFHiWzj9DfvYQPMJ6XHKNaQxaGCXwPk6y9yme3aUoaiAe+KX+vg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFJg1gm4Sn2rtNB/PqCJ5yltN+lM4Q63LhQznqebjNcPAiBnDfvx5x2Y2XWOJSh7NEryJN1ofBJkeqKGIgca9+aUpg=="}]}}},"name":"denodeify","time":{"modified":"2022-06-15T00:40:30.363Z","created":"2014-09-09T14:21:18.701Z","1.0.0":"2014-09-09T14:21:18.701Z","1.1.0":"2014-09-09T15:05:03.441Z","1.1.1":"2014-09-19T17:45:59.853Z","1.1.2":"2014-09-20T00:54:40.560Z","1.2.0":"2014-11-19T13:28:44.958Z","1.2.1":"2015-02-14T05:35:10.362Z"},"readmeFilename":"README.md","homepage":"https://github.com/matthew-andrews/denodeify"}