Commit 14cb956

Anton Golub <antongolub@antongolub.com>
2025-07-06 10:43:33
docs: add fetch timeout example (#1258)
1 parent 1a199b6
Changed files (1)
docs/api.md
@@ -140,8 +140,12 @@ A wrapper around the [node-fetch-native](https://www.npmjs.com/package/node-fetc
 package.
 
 ```js
-const resp = await fetch('https://medv.io')
-const json = await resp.json()
+const r1 = await fetch('https://example.com')
+const json = await r1.json()
+
+const r2 = await fetch('https://example.com', {
+  signal: AbortSignal.timeout(5000),
+})
 ```
 
 For some cases, `text()` or `json()` can produce extremely large output that exceeds the string size limit.