{"_id":"promisify-es6","_rev":"12-9b07d6dcad044c62ed841b46872b2184","name":"promisify-es6","time":{"modified":"2022-06-24T19:42:44.822Z","created":"2016-04-02T10:22:27.515Z","1.0.0":"2016-04-02T10:22:27.515Z","1.0.1":"2016-04-02T10:27:57.548Z","1.0.2":"2016-09-14T14:01:35.633Z","1.0.3":"2017-07-26T08:46:23.552Z"},"maintainers":[{"name":"xeryan","email":"xeryan@gmail.com"}],"dist-tags":{"latest":"1.0.3"},"description":"Promisify callback-style functions to ES6 promises","readme":"**NOTE:** Starting from Node.js v.8.0.0, the promisify method is now included in the `util` native library.\r\n\r\nOn Node.js, the usage of the native method is recommended!\r\n\r\n```\r\n// Native promisify example\r\nconst util = require('util');\r\nconst readfile = util.promisify(fs.readFile);\r\n```\r\n\r\n# ES6 Promisify\r\n## This is a library to promisify callback-style functions to ES6 promises. You can also use it on the client-side.\r\n\r\n### Install it with:\r\n\r\n    npm i --save promisify-es6\r\n    or\r\n    git clone https://github.com/manuel-di-iorio/promisify-es6.git\r\n\r\n### Example:\r\n\r\n```javascript\r\nvar promisify = require(\"promisify-es6\");\r\nvar fs = require(\"fs\");\r\nvar readFile = promisify(fs.readFile);\r\n\r\nreadFile(\"test.js\")\r\n .then(function(content) {\r\n    console.log(content.toString());\r\n })\r\n .catch(function(err) {\r\n    console.error(err);\r\n });\r\n```\r\n\r\nA promisified function is still callable with the callback style:\r\n\r\n```javascript\r\nreadFile(\"test.js\", function(err, content) { //etc...\r\n```\r\n\r\nYou can even promisify entire modules or arrays:\r\n\r\n```javascript\r\nvar readFile = promisify(require(\"fs\")).readFile;\r\n```\r\n\r\n## API\r\n\r\n```javascript\r\npromisify(method[, options])\r\n```\r\n    *Method* can be a function or an array/map of functions to promisify\r\n\r\n    *Options* can have the following properties:\r\n\r\n        `context`: The context which to apply the called function (by default is the function itself)\r\n        `replace`: When an array/map is passed and this is truthy, it will replace the original object\r\n\r\n### Test with Mocha:\r\n\r\n    npm test\r\n","versions":{"1.0.1":{"name":"promisify-es6","version":"1.0.1","description":"Promisify callback-style functions to ES6 promises","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/manuel-di-iorio/promisify-es6.git"},"keywords":["promise","promisify","es6","function","callback"],"author":{"name":"Manuel Di Iorio"},"license":"MIT","bugs":{"url":"https://github.com/manuel-di-iorio/promisify-es6/issues"},"homepage":"https://github.com/manuel-di-iorio/promisify-es6#readme","devDependencies":{"mocha":"^2.4.5"},"gitHead":"f37dad951f9c9f07f00b382fe6af96238b6d1bb9","_id":"promisify-es6@1.0.1","_shasum":"ef30c09481a9ad1539ae5088261ae8363d981c84","_from":".","_npmVersion":"3.5.3","_nodeVersion":"4.4.0","_npmUser":{"name":"xeryan","email":"xeryan@gmail.com"},"dist":{"shasum":"ef30c09481a9ad1539ae5088261ae8363d981c84","tarball":"https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.1.tgz","integrity":"sha512-TMMVYtLqLpjIzFJRqnFEPCAc/as29UPbs5rkBsB49C6sA83nYLIxyVZbwO5MLwFHL8iR3rvsvn0ilKbCVuO1uw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGJj0Gph7cjEW40Xd7zTuJrGLk9tD51go5u/OErbZS4GAiEAqsr2+fSkQKTTppUEG7p5NmLUzDJJ/2lrrIYtBc+Hh7Y="}]},"maintainers":[{"name":"xeryan","email":"xeryan@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/promisify-es6-1.0.1.tgz_1459592875166_0.7985048433765769"},"directories":{}},"1.0.2":{"name":"promisify-es6","version":"1.0.2","description":"Promisify callback-style functions to ES6 promises","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/manuel-di-iorio/promisify-es6.git"},"keywords":["promise","promisify","es6","function","callback"],"author":{"name":"Manuel Di Iorio"},"license":"MIT","bugs":{"url":"https://github.com/manuel-di-iorio/promisify-es6/issues"},"homepage":"https://github.com/manuel-di-iorio/promisify-es6#readme","devDependencies":{"mocha":"^2.4.5"},"gitHead":"8b1e5be29086426ab1e9141f781f29d5fc268a0c","_id":"promisify-es6@1.0.2","_shasum":"63093553e39be5036d757b455fb93d155da4b589","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"xeryan","email":"xeryan@gmail.com"},"dist":{"shasum":"63093553e39be5036d757b455fb93d155da4b589","tarball":"https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.2.tgz","integrity":"sha512-xemVhS44LzYU5YA7Q6IlCc3z9KX9HHlA7njExSj1xwQ9xhLd5uNggMWkSAFmPIwYshOW6qE5qPXvbUJiJ1XKBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICHUpL5WN65s0UOnmXB95DoWLb/DhEuazz9yidBdbB8XAiEA2RLzeQn76FBfVKSIUx4Ft3FN+eAa5F6aJi1Wb6/BC58="}]},"maintainers":[{"name":"xeryan","email":"xeryan@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/promisify-es6-1.0.2.tgz_1473861694007_0.26837779162451625"},"directories":{}},"1.0.3":{"author":{"name":"Manuel Di Iorio"},"bugs":{"url":"https://github.com/manuel-di-iorio/promisify-es6/issues"},"bundleDependencies":[],"deprecated":"Unmaintained","description":"Promisify callback-style functions to ES6 promises","devDependencies":{"mocha":"^2.4.5"},"homepage":"https://github.com/manuel-di-iorio/promisify-es6#readme","keywords":["promise","promisify","es6","function","callback"],"license":"MIT","main":"index.js","name":"promisify-es6","repository":{"type":"git","url":"git+https://github.com/manuel-di-iorio/promisify-es6.git"},"scripts":{"test":"mocha test"},"version":"1.0.3","gitHead":"3fb20250c335aebf22775e6b0fbb42e3f6eb662c","_id":"promisify-es6@1.0.3","_npmVersion":"5.0.3","_nodeVersion":"8.1.4","_npmUser":{"name":"xeryan","email":"xeryan@gmail.com"},"dist":{"integrity":"sha512-N9iVG+CGJsI4b4ZGazjwLnxErD2d9Pe4DPvvXSxYA9tFNu8ymXME4Qs5HIQ0LMJpNM7zj+m0NlNnNeqFpKzqnA==","shasum":"b012668c4df3c965ce13daac2b3a4d1726a96346","tarball":"https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICt8uTegJnJQWLlqOfIqX2/xrwmk4w2mOw6m4MwtWxtdAiEAiIJUJaenD9SW7MS7PftQFooSKQmRFYHmP0/iBW9uEU8="}]},"maintainers":[{"name":"xeryan","email":"xeryan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisify-es6-1.0.3.tgz_1501058781503_0.5212752232328057"},"directories":{}}},"homepage":"https://github.com/manuel-di-iorio/promisify-es6#readme","keywords":["promise","promisify","es6","function","callback"],"repository":{"type":"git","url":"git+https://github.com/manuel-di-iorio/promisify-es6.git"},"author":{"name":"Manuel Di Iorio"},"bugs":{"url":"https://github.com/manuel-di-iorio/promisify-es6/issues"},"license":"MIT","readmeFilename":"README.md"}