{
"_args": [
[
{
"raw": "pify@^3.0.0",
"scope": null,
"escapedName": "pify",
"name": "pify",
"rawSpec": "^3.0.0",
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/read-chunk"
]
],
"_from": "pify@>=3.0.0 <4.0.0",
"_id": "pify@3.0.0",
"_inCache": true,
"_location": "/pify",
"_nodeVersion": "4.8.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/pify-3.0.0.tgz_1495952727749_0.4502641425933689"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.15.11",
"_phantomChildren": {},
"_requested": {
"raw": "pify@^3.0.0",
"scope": null,
"escapedName": "pify",
"name": "pify",
"rawSpec": "^3.0.0",
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/read-chunk"
],
"_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"_shasum": "e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176",
"_shrinkwrap": null,
"_spec": "pify@^3.0.0",
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/read-chunk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/pify/issues"
},
"dependencies": {},
"description": "Promisify a callback-style function",
"devDependencies": {
"ava": "*",
"pinkie-promise": "^2.0.0",
"v8-natives": "^1.0.0",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176",
"tarball": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"gitHead": "e64328eb378e2ecd6bf8c0eb40aa3277680aaff4",
"homepage": "https://github.com/sindresorhus/pify#readme",
"keywords": [
"promise",
"promises",
"promisify",
"all",
"denodify",
"denodeify",
"callback",
"cb",
"node",
"then",
"thenify",
"convert",
"transform",
"wrap",
"wrapper",
"bind",
"to",
"async",
"await",
"es2015",
"bluebird"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "pify",
"optionalDependencies": {},
"readme": "# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify)\n\n> Promisify a callback-style function\n\n\n## Install\n\n```\n$ npm install --save pify\n```\n\n\n## Usage\n\n```js\nconst fs = require('fs');\nconst pify = require('pify');\n\n// Promisify a single function\npify(fs.readFile)('package.json', 'utf8').then(data => {\n\tconsole.log(JSON.parse(data).name);\n\t//=> 'pify'\n});\n\n// Promisify all methods in a module\npify(fs).readFile('package.json', 'utf8').then(data => {\n\tconsole.log(JSON.parse(data).name);\n\t//=> 'pify'\n});\n```\n\n\n## API\n\n### pify(input, [options])\n\nReturns a `Promise` wrapped version of the supplied function or module.\n\n#### input\n\nType: `Function` `Object`\n\nCallback-style function or module whose methods you want to promisify.\n\n#### options\n\n##### multiArgs\n\nType: `boolean`
\nDefault: `false`\n\nBy default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error.\n\n```js\nconst request = require('request');\nconst pify = require('pify');\n\npify(request, {multiArgs: true})('https://sindresorhus.com').then(result => {\n\tconst [httpResponse, body] = result;\n});\n```\n\n##### include\n\nType: `string[]` `RegExp[]`\n\nMethods in a module to promisify. Remaining methods will be left untouched.\n\n##### exclude\n\nType: `string[]` `RegExp[]`
\nDefault: `[/.+(Sync|Stream)$/]`\n\nMethods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default.\n\n##### excludeMain\n\nType: `boolean`
\nDefault: `false`\n\nIf given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module.\n\n```js\nconst pify = require('pify');\n\nfunction fn() {\n\treturn true;\n}\n\nfn.method = (data, callback) => {\n\tsetImmediate(() => {\n\t\tcallback(null, data);\n\t});\n};\n\n// Promisify methods but not `fn()`\nconst promiseFn = pify(fn, {excludeMain: true});\n\nif (promiseFn()) {\n\tpromiseFn.method('hi').then(data => {\n\t\tconsole.log(data);\n\t});\n}\n```\n\n##### errorFirst\n\nType: `boolean`
\nDefault: `true`\n\nWhether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc.\n\n##### promiseModule\n\nType: `Function`\n\nCustom promise module to use instead of the native one.\n\nCheck out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill.\n\n\n## Related\n\n- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted\n- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/pify.git"
},
"scripts": {
"optimization-test": "node --allow-natives-syntax optimization-test.js",
"test": "xo && ava && npm run optimization-test"
},
"version": "3.0.0"
}