@vercel/fetch
v7.0.0
Published
Opinionated `fetch` optimized for use inside microservices
Downloads
2,910,710
Keywords
Readme
@vercel/fetch
Opinionated fetch
optimized for use inside microservices. Bundles:
- https://github.com/vercel/fetch/tree/main/packages/fetch-retry
- https://github.com/vercel/fetch/tree/main/packages/fetch-cached-dns
- https://github.com/node-modules/agentkeepalive
It automatically configures an agent
via agentkeepalive,
if not provided, with the following settings:
| Name | Value |
| ---------------------------- | ----- |
| maxSockets
| 200 |
| maxFreeSockets
| 20 |
| timeout
| 60000 |
| freeSocketKeepAliveTimeout
| 30000 |
How to use
JavaScript
const fetch = require('@vercel/fetch')(require('some-fetch-implementation'));
TypeScript
import createFetch from '@vercel/fetch';
import * as fetch from 'some-fetch-implementation';
const fetch = createFetch(fetch);
If no fetch implementation is supplied, it will attempt to use peerDep node-fetch
.