{"name":"sb-promisify","version":"2.0.0","description":"Node module for simple promisification","main":"lib/index.js","scripts":{"test":"(apm test) && (flow check | grep -q '0 errors') && (eslint . )","clean":"rm -rf lib","build":"npm run clean; babel src --out-dir lib","watch":"npm run clean; babel src --out-dir lib --watch"},"repository":{"type":"git","url":"git+https://github.com/steelbrain/promisify.git"},"keywords":["promisify","es6","promise"],"author":{"name":"steelbrain"},"license":"MIT","bugs":{"url":"https://github.com/steelbrain/promisify/issues"},"homepage":"https://github.com/steelbrain/promisify#readme","devDependencies":{"babel-cli":"^6.11.4","babel-preset-steelbrain":"^4.0.2","eslint-config-steelbrain":"^1.0.4","flow-bin":"^0.30.0","jasmine-fix":"^1.0.1"},"gitHead":"d0d8cc87b610ab78b30cbbd3c98f86af4a254c12","_id":"sb-promisify@2.0.0","_shasum":"ca57f50850aadc1ed355f0e8e41e73103da88d68","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"steelbrain","email":"i@steelbrain.me"},"dist":{"shasum":"ca57f50850aadc1ed355f0e8e41e73103da88d68","tarball":"http://registry-npm.ywwl.com/sb-promisify/download/sb-promisify-2.0.0.tgz","integrity":"sha512-qirx5hbQW3zc87a05Ol/f5FkqOBIGZQOLoppQebBVjeihftm+W9Y1SwmdgV6e672uKXY1U7pC8oxabTEq+tj+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCywhVEzAuyBnT8QlyDk0dG8tRQCPfABQAJr6jD0lS8vgIhAJsyPzlPjZd76lvTAQexmcLHfUldQB0iw/Itph4IKf4Z"}],"size":3580,"noattachment":false,"key":"/sb-promisify/-/sb-promisify-2.0.0.tgz"},"maintainers":[{"name":"steelbrain","email":"de.steelbrain@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/sb-promisify-2.0.0.tgz_1471860843922_0.2724880848545581"},"readme":"# Promisify\n\nA node module to help you convert callback-style functions to promises\n\n## Installation\n\n```js\nnpm install --save sb-promisify\n```\n\n## API\n\n```js\nfunction promisifyAll(object, throwError = true): Object\nfunction promisify(callback, throwError = true): Function\n\nexport default promisify\nexport { promisify, promisifyAll }\n```\n\n## Example Usage\n\n```js\nimport fs from 'fs'\nimport promisify from 'sb-promisify'\n\nconst readFile = promisify(fs.readFile)\n\nreadFile('/etc/passwd', 'utf8').then(function(contents) {\n  console.log(contents)\n}, function() {\n  console.error('Unable to read file')\n})\n```\n```js\nimport fs from 'fs'\nimport { promisifyAll } from 'sb-promisify'\n\nconst promisedFS = promisifyAll(fs)\n\npromisedFS.readFileAsync('/etc/passwd', 'utf8').then(function(contents) {\n  console.log(contents)\n})\npromisedFS.readFile('/etc/passwd', 'utf8', function(contents) {\n  console.log(contents)\n})\n```\n\nIf you set throwError to false, here's how it would react\n\n```js\n'use babel'\n\nimport fs from 'fs'\nimport promisify from 'sb-promisify'\n\nconst access = promisify(fs.access, false)\nconst readFile = promisify(fs.readFile, false)\n\nreadFile('/etc/passwd').then(function(contents) {\n  if (contents === false) {\n    console.error('Unable to read file')\n  } else {\n    console.log(contents.toString('utf8'))\n  }\n})\n\naccess('/etc/passwd').then(function(access) {\n  console.log('access', access) // true or false\n})\n```\n\n## License\nThis module is licensed under the terms of MIT License. Check the LICENSE file for more info.\n","publish_time":1471860846649,"_cnpm_publish_time":1471860846649,"dist-tags":{"latest":"2.0.2"}}