{"_id":"is-network-error","_rev":"1443618","name":"is-network-error","description":"Check if a value is a Fetch network error","dist-tags":{"latest":"1.3.2"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"time":{"modified":"2026-09-14T08:33:46.000Z","created":"2023-09-26T14:15:09.619Z","1.3.2":"2026-05-08T06:17:49.465Z","1.3.1":"2026-02-26T13:51:46.844Z","1.3.0":"2025-09-18T16:43:20.189Z","1.2.0":"2025-09-16T16:41:07.774Z","1.1.0":"2024-03-19T12:38:31.098Z","1.0.1":"2024-01-04T01:38:41.893Z","1.0.0":"2023-09-26T14:15:09.619Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"versions":{"1.3.2":{"name":"is-network-error","version":"1.3.2","description":"Check if a value is a Fetch network error","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"gitHead":"b039fe8bb8da3607f8fb6a2505c40eb03aac5889","types":"./index.d.ts","_id":"is-network-error@1.3.2","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"homepage":"https://github.com/sindresorhus/is-network-error#readme","_nodeVersion":"25.8.0","_npmVersion":"11.12.0","dist":{"integrity":"sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==","shasum":"9460bc30f8419a4bca77114f4de88a3ee5e0c519","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.3.2.tgz","fileCount":5,"unpackedSize":5248,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/QV6HCpzcWgG/pkS7/wwBUUUshhAe6syDzI/uUWv1NwIgXeGuuX7u5mofrYHxyOD0i1CByP3G8o+d5DQ0oQBd0PQ="}],"size":2480,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.3.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-network-error_1.3.2_1778221069324_0.6273968229033151"},"_hasShrinkwrap":false,"publish_time":1778221069465,"_cnpm_publish_time":1778221069465},"1.3.1":{"name":"is-network-error","version":"1.3.1","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.3.1","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"a2a86b80ffd6b05b774755c73c8aaab16597e58d","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.3.1.tgz","fileCount":5,"integrity":"sha512-6QCxa49rQbmUWLfk0nuGqzql9U8uaV2H6279bRErPBHe/109hCzsLUBUHfbEtvLIHBd6hyXbgedBSHevm43Edw==","signatures":[{"sig":"MEYCIQC4DKTSADUokMxccEqY+dF50uL4XA3NRj/gTkMxavl2xAIhAOuqHyXpewsqPxTz2zeCCcL6CD1pXeNusSFp6pBTpi2D","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5182,"size":2469,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.3.1.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"ca6cca4f05caf415515d7646e42b1edc82927082","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"11.8.0","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"25.6.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.3.1_1772113906719_0.12846963177350545","host":"s3://npm-registry-packages-npm-production"},"publish_time":1772113906844,"_cnpm_publish_time":1772113906844},"1.3.0":{"name":"is-network-error","version":"1.3.0","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.3.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"2ce62cbca444abd506f8a900f39d20b898d37512","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.3.0.tgz","fileCount":5,"integrity":"sha512-6oIwpsgRfnDiyEDLMay/GqCl3HoAtH5+RUKW29gYkL0QA+ipzpDLA16yQs7/RHCSu+BwgbJaOUqa4A99qNVQVw==","signatures":[{"sig":"MEYCIQD5YlqA9fVgLRt8cCZtSML3BqumqSTcqRr6bAADNLZtcAIhAO3xfp9w9E+Mo1FSVwPO2pMV2a1h5SjdxBumAehAz4TW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4999,"size":2421,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.3.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"b119a91971649acc9893efc5aba70be044213b60","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"10.9.2","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.3.0_1758213800006_0.10742027568507417","host":"s3://npm-registry-packages-npm-production"},"publish_time":1758213800189,"_cnpm_publish_time":1758213800189},"1.2.0":{"name":"is-network-error","version":"1.2.0","keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-network-error@1.2.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"dist":{"shasum":"ca807bbd4f33967d9954fc7f02bf4176254d71b3","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.2.0.tgz","fileCount":5,"integrity":"sha512-32jdpRpJo8SeL7zOuBJbMLz/VTw9mDpTvcKzzR8DkXWsJbbE60gdiX8YOd0UAV6b8Skt+CMytzfgVVIRFidn0Q==","signatures":[{"sig":"MEUCIHFW7VUcdarfPXdHHcLrLAlOI9Y5p/hqY8rV4Ge3Zv/DAiEAvf60no8FlaO3zaZJUq4LtzLGL3j4A8/4UKvaJGCX+pM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4941,"size":2394,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.2.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"fdec607d793f11a003965078033b19430d4abde0","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-network-error.git","type":"git"},"_npmVersion":"10.9.2","description":"Check if a value is a Fetch network error","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","tsd":"^0.29.0"},"_npmOperationalInternal":{"tmp":"tmp/is-network-error_1.2.0_1758040867578_0.35605332681132174","host":"s3://npm-registry-packages-npm-production"},"publish_time":1758040867774,"_cnpm_publish_time":1758040867774},"1.1.0":{"name":"is-network-error","version":"1.1.0","description":"Check if a value is a Fetch network error","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"types":"./index.d.ts","gitHead":"9710d1f0e1f75e6775bbedc909fcb96851031787","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"homepage":"https://github.com/sindresorhus/is-network-error#readme","_id":"is-network-error@1.1.0","_nodeVersion":"20.11.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==","shasum":"d26a760e3770226d11c169052f266a4803d9c997","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.1.0.tgz","fileCount":5,"unpackedSize":4537,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICUgiWIKSiIq6jE54UR3a5I7MfjTprrnzrA9hNuSAM/nAiBWYy6R7vcSrArqDxzVs4Q8jhxuNie5B4rXmGVfq83HpQ=="}],"size":2217,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-network-error_1.1.0_1710851910941_0.9807955355246603"},"_hasShrinkwrap":false,"publish_time":1710851911098,"_cnpm_publish_time":1710851911098},"1.0.1":{"name":"is-network-error","version":"1.0.1","description":"Check if a value is a Fetch network error","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"types":"./index.d.ts","gitHead":"bb1d9eaff47c5391bdfa834364ffcafd2c353c1d","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"homepage":"https://github.com/sindresorhus/is-network-error#readme","_id":"is-network-error@1.0.1","_nodeVersion":"21.2.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-OwQXkwBJeESyhFw+OumbJVD58BFBJJI5OM5S1+eyrDKlgDZPX2XNT5gXS56GSD3NPbbwUuMlR1Q71SRp5SobuQ==","shasum":"a68061a20387e9144e145571bea693056a370b92","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.0.1.tgz","fileCount":5,"unpackedSize":4502,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCAnJKyCWGYeN3AviqAEKKG+SRVXDaNDPsVhq4Z0AAMjAIhAMAiQr8AcztT3NCMPORc+3alY33Mkpyu7I2T9M5FzICe"}],"size":2205,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-network-error_1.0.1_1704332321723_0.7927684548450891"},"_hasShrinkwrap":false,"publish_time":1704332321893,"_cnpm_publish_time":1704332321893},"1.0.0":{"name":"is-network-error","version":"1.0.0","description":"Check if a value is a Fetch network error","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-network-error.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["network","error","fetch","whatwg","detect","check","typeerror"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"types":"./index.d.ts","gitHead":"88b46c29fcb69700ab8919be1fd322a234ccbf40","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"homepage":"https://github.com/sindresorhus/is-network-error#readme","_id":"is-network-error@1.0.0","_nodeVersion":"16.20.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-P3fxi10Aji2FZmHTrMPSNFbNC6nnp4U5juPAIjXPHkUNubi4+qK7vvdsaNpAUwXslhYm9oyjEYTxs1xd/+Ph0w==","shasum":"757d7af42263f18f616626e63af12abb19002bbc","tarball":"http://registry-npm.ywwl.com/is-network-error/download/is-network-error-1.0.0.tgz","fileCount":5,"unpackedSize":4460,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFhVjNkxVQGsWk3mbp3D0lwdTU8iEbx2CuqpRdB0VmY9AiEAmRketzkY1t6lHRBY4VM4BQknciW12a5GCg8k8/aeWJQ="}],"size":2190,"noattachment":false,"key":"/is-network-error/-/is-network-error-1.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-network-error_1.0.0_1695737709369_0.7316419387319419"},"_hasShrinkwrap":false,"publish_time":1695737709619,"_cnpm_publish_time":1695737709619}},"readme":"# is-network-error\n\n> Check if a value is a [Fetch network error](https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions)\n\nThis can be useful when you want to do something specific when a network error happens without catching other Fetch-related errors.\n\nUnfortunately, Fetch network errors are [not standardized](https://github.com/whatwg/fetch/issues/526) and differ among implementations. This package handles the differences across Node.js, Bun, Deno, and browsers.\n\nFor instance, [`p-retry`](https://github.com/sindresorhus/p-retry) uses this package to retry on network errors.\n\n## Install\n\n```sh\nnpm install is-network-error\n```\n\n## Usage\n\n```js\nimport isNetworkError from 'is-network-error';\n\nasync function getUnicorns() {\n\ttry {\n\t\tconst response = await fetch('unicorns.json');\n\t\treturn await response.json();\n\t} catch (error) {\n\t\tif (isNetworkError(error)) {\n\t\t\treturn localStorage.getItem('…');\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nconsole.log(await getUnicorns());\n```\n\n## API\n\n### `isNetworkError(value: unknown): value is TypeError`\n\nReturns `true` if the given value is a Fetch network error, otherwise `false`.\n\nThis function acts as a type guard, narrowing the type to `TypeError` when it returns `true`.\n","_attachments":{},"homepage":"https://github.com/sindresorhus/is-network-error#readme","bugs":{"url":"https://github.com/sindresorhus/is-network-error/issues"},"license":"MIT"}