{
  "name": "promisify-node",
  "version": "0.4.0",
  "description": "Wrap Node-callback functions to return Promises.",
  "main": "index.js",
  "dependencies": {
    "nodegit-promise": "~4.0.0",
    "object-assign": "^4.0.1"
  },
  "devDependencies": {
    "mocha": "~1.18.2",
    "istanbul": "~0.2.7"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/nodegit/promisify-node.git"
  },
  "scripts": {
    "test": "istanbul cover _mocha -- test"
  },
  "author": {
    "name": "Tim Branyen",
    "url": "@tbranyen"
  },
  "license": "MIT",
  "readme": "Promisify Node\n--------------\n\n**Stable: 0.1.5** \n\n[![Build\nStatus](https://travis-ci.org/nodegit/promisify-node.png?branch=master)](https://travis-ci.org/nodegit/promisify-node)\n\nMaintained by Tim Branyen [@tbranyen](http://twitter.com/tbranyen).\n\nWraps Node modules, functions, and methods written in the Node-callback style\nto return Promises.\n\n### Install ###\n\n``` bash\nnpm install promisify-node\n```\n\n### Examples ###\n\nWrap entire Node modules recursively:\n\n``` javascript\nvar promisify = require(\"promisify-node\");\nvar fs = promisify(\"fs\");\n\n// This function has been identified as an asynchronous function so it has\n// been automatically wrapped.\nfs.readFile(\"/etc/passwd\").then(function(contents) {\n  console.log(contents);\n});\n```\n\nWrap a single function:\n\n``` javascript\nvar promisify = require(\"promisify-node\");\n\nfunction async(callback) {\n  callback(null, true);\n}\n\n// Convert the function to return a Promise.\nvar wrap = promisify(async);\n\n// Invoke the newly wrapped function.\nwrap().then(function(value) {\n  console.log(value === true);\n});\n```\n\nWrap a method on an Object:\n\n``` javascript\nvar promisify = require(\"promisify-node\");\n\nvar myObj = {\n  myMethod: function(a, b, cb) {\n    cb(a, b);\n  }\n};\n\n// No need to return anything as the methods will be replaced on the object.\npromisify(myObj);\n\n// Intentionally cause a failure by passing an object and inspect the message.\nmyObj.myMethod({ msg: \"Failure!\" }, null).then(null, function(err) {\n  console.log(err.msg);\n});\n```\n\nWrap without mutating the original:\n```javascript\nvar promisify = require(\"promisify-node\");\n\nvar myObj = {\n  myMethod: function(a, b, cb) {\n    cb(a, b);\n  }\n};\n\n// Store the original method to check later\nvar originalMethod = myObj.myMethod;\n\n// Now store the result, since the 'true' value means it won't mutate 'myObj'.\nvar promisifiedObj = promisify(myObj, undefined, true);\n\n// Intentionally cause a failure by passing an object and inspect the message.\npromisifiedObj.myMethod({ msg: \"Failure!\" }, null).then(null, function(err) {\n  console.log(err.msg);\n});\n\n// The original method is still intact\nassert(myObj.myMethod === originalMethod);\nassert(promisifiedObj.myMethod !== myObj.myMethod);\n```\n\n### Tests ###\n\nRun the tests after installing dependencies with:\n\n``` bash\nnpm test\n```\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/nodegit/promisify-node/issues"
  },
  "_id": "promisify-node@0.4.0",
  "dist": {
    "shasum": "89fdd930321818f4ed31e0a66a81309eb9aee943"
  },
  "_from": "promisify-node@^0.4.0",
  "_resolved": "https://registry.npmjs.org/promisify-node/-/promisify-node-0.4.0.tgz"
}
