UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

113 lines (112 loc) 4.73 kB
{ "_args": [ [ { "raw": "p-timeout@^2.0.1", "scope": null, "escapedName": "p-timeout", "name": "p-timeout", "rawSpec": "^2.0.1", "spec": ">=2.0.1 <3.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/got" ] ], "_from": "p-timeout@>=2.0.1 <3.0.0", "_id": "p-timeout@2.0.1", "_inCache": true, "_location": "/p-timeout", "_nodeVersion": "8.9.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/p-timeout-2.0.1.tgz_1511899601223_0.9610305042006075" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "5.5.1", "_phantomChildren": {}, "_requested": { "raw": "p-timeout@^2.0.1", "scope": null, "escapedName": "p-timeout", "name": "p-timeout", "rawSpec": "^2.0.1", "spec": ">=2.0.1 <3.0.0", "type": "range" }, "_requiredBy": [ "/got" ], "_resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", "_shasum": "d8dd1979595d2dc0139e1fe46b8b646cb3cdf038", "_shrinkwrap": null, "_spec": "p-timeout@^2.0.1", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/got", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/p-timeout/issues" }, "dependencies": { "p-finally": "^1.0.0" }, "description": "Timeout a promise after a specified amount of time", "devDependencies": { "ava": "*", "delay": "^2.0.0", "p-cancelable": "^0.3.0", "xo": "*" }, "directories": {}, "dist": { "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", "shasum": "d8dd1979595d2dc0139e1fe46b8b646cb3cdf038", "tarball": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz" }, "engines": { "node": ">=4" }, "files": [ "index.js" ], "gitHead": "db65c4b51196c505ac005ce5b665d41a246ed253", "homepage": "https://github.com/sindresorhus/p-timeout#readme", "keywords": [ "promise", "timeout", "error", "invalidate", "async", "await", "promises", "time", "out", "cancel", "bluebird" ], "license": "MIT", "maintainers": [ { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "name": "p-timeout", "optionalDependencies": {}, "readme": "# p-timeout [![Build Status](https://travis-ci.org/sindresorhus/p-timeout.svg?branch=master)](https://travis-ci.org/sindresorhus/p-timeout)\n\n> Timeout a promise after a specified amount of time\n\n\n## Install\n\n```\n$ npm install p-timeout\n```\n\n\n## Usage\n\n```js\nconst delay = require('delay');\nconst pTimeout = require('p-timeout');\n\nconst delayedPromise = delay(200);\n\npTimeout(delayedPromise, 50).then(() => 'foo');\n//=> [TimeoutError: Promise timed out after 50 milliseconds]\n```\n\n\n## API\n\n### pTimeout(input, ms, [message | fallback])\n\nReturns a decorated `input` that times out after `ms` time.\n\nIf you pass in a cancelable promise, specifically a promise with a `.cancel()` method, that method will be called when the `pTimeout` promise times out.\n\n#### input\n\nType: `Promise`\n\nPromise to decorate.\n\n#### ms\n\nType: `number`\n\nMilliseconds before timing out.\n\n#### message\n\nType: `string` `Error`<br>\nDefault: `'Promise timed out after 50 milliseconds'`\n\nSpecify a custom error message or error.\n\nIf you do a custom error, it's recommended to sub-class `pTimeout.TimeoutError`.\n\n#### fallback\n\nType: `Function`\n\nDo something other than rejecting with an error on timeout.\n\nYou could for example retry:\n\n```js\nconst delay = require('delay');\nconst pTimeout = require('p-timeout');\n\nconst delayedPromise = () => delay(200);\n\npTimeout(delayedPromise(), 50, () => {\n\treturn pTimeout(delayedPromise(), 300);\n});\n```\n\n### pTimeout.TimeoutError\n\nExposed for instance checking and sub-classing.\n\n\n## Related\n\n- [delay](https://github.com/sindresorhus/delay) - Delay a promise a specified amount of time\n- [p-min-delay](https://github.com/sindresorhus/p-min-delay) - Delay a promise a minimum amount of time\n- [p-retry](https://github.com/sindresorhus/p-retry) - Retry a promise-returning function\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/p-timeout.git" }, "scripts": { "test": "xo && ava" }, "version": "2.0.1" }