Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vercel/fetch-cached-dns
A decorator on top of `fetch` that caches the DNS query
https://github.com/vercel/fetch-cached-dns
Last synced: 3 months ago
JSON representation
A decorator on top of `fetch` that caches the DNS query
- Host: GitHub
- URL: https://github.com/vercel/fetch-cached-dns
- Owner: vercel
- License: mit
- Archived: true
- Created: 2017-10-18T20:49:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T19:54:23.000Z (almost 3 years ago)
- Last Synced: 2024-09-23T02:32:21.141Z (3 months ago)
- Language: JavaScript
- Size: 469 KB
- Stars: 37
- Watchers: 59
- Forks: 10
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# fetch-cached-dns
**This repo has been archived and the source has been moved to [vercel/fetch](https://github.com/vercel/fetch) monorepo**
A decorator on top of `fetch` that caches the DNS query of the `hostname` of the passed URL.
## How to use
```js
const fetch = require('@vercel/fetch-cached-dns')(require('node-fetch'))
```Since this implementation is implementing redirects we are providing an `onRedirect` extra
option to the `fetch` call that gets called with the response object and the options that
will be used for the next request. This allows to access the request from outside and to
modify the options.*NOTE: if the fetch implementation is not supplied, it will attempt to use peerDep `node-fetch`*