# @vercel/fetch-cached-dns

> A decorator on top of `fetch` that caches the DNS query of the `hostname` of the passed URL

Latest version **2.1.2** (published 2022-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vercel/fetch-cached-dns
pnpm add @vercel/fetch-cached-dns
yarn add @vercel/fetch-cached-dns
bun add @vercel/fetch-cached-dns
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2022-09-21 |
| First published | 2020-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 570 |
| Maintainers | vercel-release-bot, zeit-bot |

## Links

- npm: https://www.npmjs.com/package/@vercel/fetch-cached-dns
- Repository: https://github.com/vercel/fetch
- Homepage: https://github.com/vercel/fetch#readme
- Issues: https://github.com/vercel/fetch/issues
- npm.io page: https://npm.io/package/@vercel/fetch-cached-dns

## Dependencies (2)

- [@types/node-fetch](https://npm.io/package/@types/node-fetch.md) ^2.6.1
- [@zeit/dns-cached-resolve](https://npm.io/package/@zeit/dns-cached-resolve.md) ^2.1.2

## Recent versions

- 2.1.2 (latest) — 2022-09-21
- 2.1.1 — 2022-09-21
- 2.1.0 — 2022-02-28
- 2.0.2 — 2021-06-05
- 2.0.1 — 2020-10-16
- 2.0.0 — 2020-10-16

## README

# @vercel/fetch-cached-dns

[![Build Status](https://github.com/vercel/fetch/workflows/CI/badge.svg)](https://github.com/vercel/fetch/actions?workflow=CI)

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`_

---
_Source: https://npm.io/package/@vercel/fetch-cached-dns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
