{"_id":"@altipla/fetch-timeout","_rev":"1-739126e8c7c702f8958583bd07fb3ca3","name":"@altipla/fetch-timeout","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.3":{"name":"@altipla/fetch-timeout","version":"0.1.3","description":"Implement timeout and cancellation on top of node-fetch or standard fetch.","main":"./dist/index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/altipla-consulting/fetch-timeout.git"},"author":{"name":"Altipla Consulting"},"license":"MIT","bugs":{"url":"https://github.com/altipla-consulting/fetch-timeout/issues"},"homepage":"https://github.com/altipla-consulting/fetch-timeout#readme","publishConfig":{"access":"public"},"scripts":{"lib":"tsc --declaration --esModuleInterop --outDir dist","lint":"tsc --noEmit && eslint --ext .ts src","fix":"eslint --fix --ext .ts src","test":"vitest run","watch":"vitest"},"devDependencies":{"@altipla/eslint-config-ts":"^0.6.0","eslint":"^8.38.0","typescript":"^5.0.4","vitest":"^0.30.1"},"dependencies":{"node-fetch":"^3.3.1"},"types":"./dist/index.d.ts","gitHead":"10252ac2f0281543d555f42bb7d8039302d91e54","_id":"@altipla/fetch-timeout@0.1.3","_nodeVersion":"16.20.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-JVHyMnglv5S/33mBfUnY7u04HnJplXDjXPw3E2/GxBG8OUbpf2lrHVdOb1uh2ZjnynfJ+mQw/VvXDQu5fYUyWQ==","shasum":"041461ab62c752648d4337c2a8e134d3c286ad49","tarball":"https://registry.npmjs.org/@altipla/fetch-timeout/-/fetch-timeout-0.1.3.tgz","fileCount":9,"unpackedSize":7070,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8IOCg2P+OcdEWI3Xy3dYqKDD5wCcW6W4K7FYWxiHPEAiBMu5usfIdxpz9WTvkfHuczkbZAU7hJtZLv8mHrb3p+gQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkN8sGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpoKQ//XSN8NttEhoZai3CSGyRzUL0sIYn2PhET+mKLbwW627pg2UUH\r\nb/NobuI0OOYU8MHT29h0qSl7h3zkPwyCKXKHBLO+I6VEtbpWZMXPf4w3OGie\r\nA/5Zq4GxhJQQ8+MLsyU6b1dV1urMT7ge1xwlEyDKwP+l685hZxoXRY65hoho\r\nwjZLlB0TaVJBZa2FyFuq1yJ8atjSiEOlJ4QNd1JZ0RNlEmfiznaBfJ2eRLDd\r\ncf1/dn6V8he1g9+g3wSatXbZ/UxE2VTkXVmJIrz1Z0eGW1+E3GPknFUazGnA\r\nIWGwmRtB8fCWkH9OQmBJkPn1rvH/Q3DH4ecGQiWN8mllrL4zOeLZMSygIKCl\r\n8VLC1vxB2eY24hYQz9X//feNegqECFj6Wl50Cw5krFViXJzSUJpJ/PqvaSHk\r\nGBstNkJ40bVoIEJBp+x8nWC2Xs7MGe0FETCY4Xrb6vYpLPbZisp+KyXzIM77\r\nLWgWxj7H3r68pUYSVoeN2NnBz+Wp2LxrubbjFPI0qZxTQZKiB4qVCwCt716D\r\np5UbgXZ7yHSwckAhvrVOHmKtm24BqRiNlh79lMVKwXs6PGNtJTJD9HjmsJZ9\r\njq5XQuXMLcshqECh54tvOrS4Icas16gKFGRGoV+1ymedgiRYBmF0LN8W0YvL\r\n32sA7LujM1lE0L5zvTgb0eP6JHALq22PhEE=\r\n=WIgk\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ernestoalejo","email":"contact@ernestoalejo.me"},"directories":{},"maintainers":[{"name":"ernestoalejo","email":"contact@ernestoalejo.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fetch-timeout_0.1.3_1681378054295_0.6949099943919299"},"_hasShrinkwrap":false},"0.1.4":{"name":"@altipla/fetch-timeout","version":"0.1.4","description":"Implement timeout and cancellation on top of node-fetch or standard fetch.","main":"./dist/index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/altipla-consulting/fetch-timeout.git"},"author":{"name":"Altipla Consulting"},"license":"MIT","bugs":{"url":"https://github.com/altipla-consulting/fetch-timeout/issues"},"homepage":"https://github.com/altipla-consulting/fetch-timeout#readme","publishConfig":{"access":"public"},"scripts":{"lib":"tsc --declaration --esModuleInterop --outDir dist","lint":"tsc --noEmit && eslint --ext .ts src","fix":"eslint --fix --ext .ts src","test":"vitest run","watch":"vitest"},"devDependencies":{"@altipla/eslint-config-ts":"^0.6.0","eslint":"^8.38.0","typescript":"^5.0.4","vitest":"^0.30.1"},"dependencies":{"node-fetch":"^3.3.1"},"types":"./dist/index.d.ts","gitHead":"a781dd021cd72303a89037c8f15a0ff63f6329e5","_id":"@altipla/fetch-timeout@0.1.4","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-bCZBG9Y70qDC6OR0kwSPEvd16OzH7F0Rej+UM21K/Yz9evMe2EFRqA1tH4Jt2b25L4gb5A0CmwBpX09LVoxMsw==","shasum":"49f7f03d26db16d2682157aaf5cbf5c1a3f658c6","tarball":"https://registry.npmjs.org/@altipla/fetch-timeout/-/fetch-timeout-0.1.4.tgz","fileCount":7,"unpackedSize":6168,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDvay8udMnVEB0kIMQs8MWHAq808D4UxassIISA4yHPwIhALvlc8acx/Qvf2XEzUR/hFErZDWjp0V9rb58f/HxChWP"}]},"_npmUser":{"name":"ernestoalejo","email":"contact@ernestoalejo.me"},"directories":{},"maintainers":[{"name":"ernestoalejo","email":"contact@ernestoalejo.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fetch-timeout_0.1.4_1692183338472_0.5179530389538711"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-13T09:27:34.237Z","0.1.3":"2023-04-13T09:27:34.441Z","modified":"2023-08-16T10:55:38.814Z","0.1.4":"2023-08-16T10:55:38.627Z"},"maintainers":[{"name":"ernestoalejo","email":"contact@ernestoalejo.me"}],"description":"Implement timeout and cancellation on top of node-fetch or standard fetch.","homepage":"https://github.com/altipla-consulting/fetch-timeout#readme","repository":{"type":"git","url":"git+https://github.com/altipla-consulting/fetch-timeout.git"},"author":{"name":"Altipla Consulting"},"bugs":{"url":"https://github.com/altipla-consulting/fetch-timeout/issues"},"license":"MIT","readme":"\n# fetch-timeout\n\nImplement timeout and cancellation on top of node-fetch or standard fetch.\n\n\n## Install\n\n```sh\nnpm install fetch-timeout\n```\n\n\n## Usage\n\nReplace any call to `fetch` with our helper `fetchTimeout`. Types are compatible as we only add a new option `timeout` that can be added when needed.\n\n### With no timeout (normal fetch)\n\n```ts\nlet reply = await fetch('https://www.example.com/', {\n  method: 'POST',\n  body: '...',\n  headers: { ... },\n})\n```\n\n### With a timeout\n\n```ts\nlet reply = await fetch('https://www.example.com/', {\n  method: 'POST',\n  body: '...',\n  headers: { ... },\n  timeout: 30000, // milliseconds\n})\n```\n\n### With a timeout and a cancel signal combined\n\n```ts\nlet ctrl = new AbortController()\n\nabortButton.addEventListener('click', () => ctrl.abort())\n\nlet reply = await fetch('https://www.example.com/', {\n  method: 'POST',\n  body: '...',\n  headers: { ... },\n  timeout: 30000,\n  signal: controller.signal,\n})\n```\n\n\n### Check if there was a timeout\n\n```ts\ntry {\n  let reply = await fetch('https://www.example.com/', {\n    timeout: 5000,\n  })\n} catch (err: any) {\n  if (err.name === 'AbortError') {\n    ...\n  }\n}\n```\n","readmeFilename":"README.md"}