{
  "manifest": {
    "name": "p-retry",
    "version": "4.6.2",
    "description": "Retry a promise-returning or async function",
    "license": "MIT",
    "repository": {
      "type": "git",
      "url": "https://github.com/sindresorhus/p-retry.git"
    },
    "author": {
      "name": "Sindre Sorhus",
      "email": "sindresorhus@gmail.com",
      "url": "sindresorhus.com"
    },
    "engines": {
      "node": ">=8"
    },
    "scripts": {
      "test": "xo && ava && tsd"
    },
    "files": [
      "index.js",
      "index.d.ts"
    ],
    "keywords": [
      "promise",
      "retry",
      "retries",
      "operation",
      "failed",
      "rejected",
      "try",
      "exponential",
      "backoff",
      "attempt",
      "async",
      "await",
      "promises",
      "concurrently",
      "concurrency",
      "parallel",
      "bluebird"
    ],
    "dependencies": {
      "@types/retry": "0.12.0",
      "retry": "^0.13.1"
    },
    "devDependencies": {
      "ava": "^2.4.0",
      "delay": "^4.1.0",
      "tsd": "^0.10.0",
      "xo": "^0.25.3"
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-p-retry-4.6.2-9baae7184057edd4e17231cee04264106e092a16-integrity/node_modules/p-retry/package.json",
    "readmeFilename": "readme.md",
    "readme": "# p-retry\n\n> Retry a promise-returning or async function\n\nIt does exponential backoff and supports custom retry strategies for failed operations.\n\n## Install\n\n```\n$ npm install p-retry\n```\n\n## Usage\n\n```js\nconst pRetry = require('p-retry');\nconst fetch = require('node-fetch');\n\nconst run = async () => {\n\tconst response = await fetch('https://sindresorhus.com/unicorn');\n\n\t// Abort retrying if the resource doesn't exist\n\tif (response.status === 404) {\n\t\tthrow new pRetry.AbortError(response.statusText);\n\t}\n\n\treturn response.blob();\n};\n\n(async () => {\n\tconsole.log(await pRetry(run, {retries: 5}));\n})();\n```\n\n## API\n\n### pRetry(input, options?)\n\nReturns a `Promise` that is fulfilled when calling `input` returns a fulfilled promise. If calling `input` returns a rejected promise, `input` is called again until the maximum number of retries is reached. It then rejects with the last rejection reason.\n\n\nDoes not retry on most `TypeErrors`, with the exception of network errors. This is done on a best case basis as different browsers have different [messages](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Checking_that_the_fetch_was_successful) to indicate this. See [whatwg/fetch#526 (comment)](https://github.com/whatwg/fetch/issues/526#issuecomment-554604080)\n\n\n#### input\n\nType: `Function`\n\nReceives the current attempt number as the first argument and is expected to return a `Promise` or any value.\n\n#### options\n\nType: `object`\n\nOptions are passed to the [`retry`](https://github.com/tim-kos/node-retry#retryoperationoptions) module.\n\n##### onFailedAttempt(error)\n\nType: `Function`\n\nCallback invoked on each retry. Receives the error thrown by `input` as the first argument with properties `attemptNumber` and `retriesLeft` which indicate the current attempt number and the number of attempts left, respectively.\n\n```js\nconst run = async () => {\n\tconst response = await fetch('https://sindresorhus.com/unicorn');\n\n\tif (!response.ok) {\n\t\tthrow new Error(response.statusText);\n\t}\n\n\treturn response.json();\n};\n\n(async () => {\n\tconst result = await pRetry(run, {\n\t\tonFailedAttempt: error => {\n\t\t\tconsole.log(`Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} retries left.`);\n\t\t\t// 1st request => Attempt 1 failed. There are 4 retries left.\n\t\t\t// 2nd request => Attempt 2 failed. There are 3 retries left.\n\t\t\t// …\n\t\t},\n\t\tretries: 5\n\t});\n\n\tconsole.log(result);\n})();\n```\n\nThe `onFailedAttempt` function can return a promise. For example, you can do some async logging:\n\n```js\nconst pRetry = require('p-retry');\nconst logger = require('./some-logger');\n\nconst run = async () => { … };\n\n(async () => {\n\tconst result = await pRetry(run, {\n\t\tonFailedAttempt: async error => {\n\t\t\tawait logger.log(error);\n\t\t}\n\t});\n})();\n```\n\nIf the `onFailedAttempt` function throws, all retries will be aborted and the original promise will reject with the thrown error.\n\n### pRetry.AbortError(message)\n### pRetry.AbortError(error)\n\nAbort retrying and reject the promise.\n\n### message\n\nType: `string`\n\nError message.\n\n### error\n\nType: `Error`\n\nCustom error.\n\n## Tip\n\nYou can pass arguments to the function being retried by wrapping it in an inline arrow function:\n\n```js\nconst pRetry = require('p-retry');\n\nconst run = async emoji => {\n\t// …\n};\n\n(async () => {\n\t// Without arguments\n\tawait pRetry(run, {retries: 5});\n\n\t// With arguments\n\tawait pRetry(() => run('🦄'), {retries: 5});\n})();\n```\n\n## Related\n\n- [p-timeout](https://github.com/sindresorhus/p-timeout) - Timeout a promise after a specified amount of time\n- [More…](https://github.com/sindresorhus/promise-fun)\n",
    "licenseText": "MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.2.tgz#9baae7184057edd4e17231cee04264106e092a16",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.2.tgz",
    "hash": "9baae7184057edd4e17231cee04264106e092a16",
    "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
    "registry": "npm",
    "packageName": "p-retry",
    "cacheIntegrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ== sha1-m6rnGEBX7dThcjHO4EJkEG4JKhY="
  },
  "registry": "npm",
  "hash": "9baae7184057edd4e17231cee04264106e092a16"
}