94 lines
8.2 KiB
JSON
94 lines
8.2 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "pn@^1.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "pn",
|
||
|
"name": "pn",
|
||
|
"rawSpec": "^1.1.0",
|
||
|
"spec": ">=1.1.0 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom"
|
||
|
]
|
||
|
],
|
||
|
"_from": "pn@>=1.1.0 <2.0.0",
|
||
|
"_id": "pn@1.1.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/pn",
|
||
|
"_nodeVersion": "9.3.0",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "s3://npm-registry-packages",
|
||
|
"tmp": "tmp/pn-1.1.0.tgz_1515011741437_0.9148412847425789"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "cscott",
|
||
|
"email": "cscott@cscott.net"
|
||
|
},
|
||
|
"_npmVersion": "5.6.0",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "pn@^1.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "pn",
|
||
|
"name": "pn",
|
||
|
"rawSpec": "^1.1.0",
|
||
|
"spec": ">=1.1.0 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/jsdom"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
|
||
|
"_shasum": "e2f4cef0e219f463c179ab37463e4e1ecdccbafb",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "pn@^1.1.0",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom",
|
||
|
"author": {
|
||
|
"name": "C. Scott Ananian"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/cscott/node-pn/issues"
|
||
|
},
|
||
|
"dependencies": {},
|
||
|
"description": "Promisify the node standard library.",
|
||
|
"devDependencies": {
|
||
|
"es6-shim": "~0.35.3",
|
||
|
"mocha": "~3.5.0",
|
||
|
"prfun": "~2.1.4"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
|
||
|
"shasum": "e2f4cef0e219f463c179ab37463e4e1ecdccbafb",
|
||
|
"tarball": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz"
|
||
|
},
|
||
|
"gitHead": "376778921fbdaf3eb63552f7349e52addb6b8cd1",
|
||
|
"homepage": "https://github.com/cscott/node-pn#readme",
|
||
|
"keywords": [
|
||
|
"promise",
|
||
|
"node"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "cscott",
|
||
|
"email": "cscott@cscott.net"
|
||
|
}
|
||
|
],
|
||
|
"name": "pn",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# pn\n[![NPM][NPM1]][NPM2]\n\n[![Build Status][1]][2]\n\nThe `pn` library gives you the Promise-using node standard library\nyou've always dreamed of. Think \"Promised Node\" when saying it.\n\nJust about every node standard library method that takes a callback will now\nreturn a `Promise` iff no callback is supplied. But existing code\nthat passes callbacks will still work fine --- and fast: No unnecessary\n`Promise`s are created if you supply a callback.\n\nThe wrappers are generated automatically by a script, with a table to\nhandle exceptions and odd cases. See below for more details.\n\n## Installation\n```\nnpm install pn\n```\n## Usage\n```\nvar fs = require('pn/fs');\nfs.writeFile('foo', 'bar', 'utf-8').then(function() { console.log('done'); });\n// But you can use callbacks, too -- existing code won't break.\nfs.writeFile('foo', 'bat', 'utf-8', function(err) { console.log('yay'); });\n```\n\nThis library uses node native promises (ie `global.Promise`) by\ndefault, and thus works with node >= 0.11.\n\nYou can use [`core-js`](https://www.npmjs.org/package/core-js) or\n[`es6-shim`](https://www.npmjs.org/package/es6-shim)\nto add ES6 Promises to earlier versions of node, for example:\n```\nrequire('es6-shim');\nvar fs = require('pn/fs');\n```\nJust be sure that `es6-shim` is loaded before the `pn` package in that\ncase.\n\nYou might also want to look into packages like\n[`prfun`](https://www.npmjs.org/package/prfun)\nwhich add some helpers to make working with native promises much more\nfun.\n\nIn particular, the `Promise#done` method is very useful when\ndebugging, at least until v8's native Promise debugging\ncapabilities are completed.\n\n## Custom Promise types\n\nYou can also specify a custom `Promise` type to use, as follows:\n```\nvar MyPromise = require('prfun'); // Use prfun's Promises, for example.\nrequire('pn/_promise')(MyPromise); // This only needs to be done once.\n```\n\n## Exceptions and odd cases\n\nThe wrappers are automatically generated by `scripts/generate.js`;\nthere is a table in that file which specifies all the odd cases.\n\nIn general: if the node API has a callback which takes multiple\nvalue arguments, the `Promise` returned will be an object with\nnamed fields corresponding to the different values. If the node\nAPI takes a callback *and* returns a value, `pn` will return\nthe original value with a nonenumerable field named `promise`\ncorresponding to the callback. Combining these two cases:\n```\nvar child_process = require('pn/child_process');\nvar cp = child_process.execFile('true');\nconsole.log('pid', cp.pid);\ncp.promise.then(function(result) {\n console.log('stdout: ', result.stdout);\n console.log('stderr: ', result.stderr);\n});\n```\n\n* `child_process`: The `exec` and `execFile` methods promise a object\n with fields named `stdout` and `stderr`. They return a `ChildProcess`\n object with a nonenumerable field named `promise` corresponding to the\n callback.\n* `crypto`: The `randomBytes` and `pseudoRandomBytes` methods are\n now always asynchronous, returning a `Promise` if no callback\n is supplied. Use the new `randomBytesSync` and `pseudoRandomBytesSync`\n methods if you want synchronous computation. *This is backwards\n incompatible with existing node code.*\n* `dns`: The `lookupService` method promises an object with\n fields named `hostname` and `service`.\n* `fs`: The `exists` method doesn't pass an error to its callback.\n The promisied version will never reject. The `write` method promises\n an object with fields named `written` and `data`. The `read` method\n promises an object with fields named `read` and `data`.\n* `http`, `https`: The `request` and `get` methods return a `ClientRequest`\n object with a nonenumerable field named `promise`, which will\n resolve to an `IncomingMessage` object.\n* `process`: You can defer computation to the next tick with\n `require('pn/process').nextTick().then(function(){...})`\n* `tls`: The `connect` and `createServer` return objects with a\n nonenumerable field named `promise`.\n\nThere ar
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git://github.com/cscott/node-pn.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"generate": "scripts/generate.js",
|
||
|
"test": "mocha"
|
||
|
},
|
||
|
"version": "1.1.0"
|
||
|
}
|