# isomorphic-unfetch

> Switches between unfetch & node-fetch for client & server.

Latest version **4.0.2** (published 2023-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install isomorphic-unfetch
pnpm add isomorphic-unfetch
yarn add isomorphic-unfetch
bun add isomorphic-unfetch
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2023-01-03 |
| First published | 2017-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5697 |
| Maintainers | developit |

## Links

- npm: https://www.npmjs.com/package/isomorphic-unfetch
- Repository: https://github.com/developit/unfetch
- Homepage: https://github.com/developit/unfetch#readme
- Issues: https://github.com/developit/unfetch/issues
- npm.io page: https://npm.io/package/isomorphic-unfetch

## Dependencies (2)

- [unfetch](https://npm.io/package/unfetch.md) ^5.0.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.2.0

## Recent versions

- 4.0.2 (latest) — 2023-01-03
- 4.0.1 — 2022-12-31
- 4.0.0 — 2022-12-31
- 3.1.0 — 2020-09-29
- 3.0.0 — 2018-09-17
- 2.1.1 — 2018-07-30
- 2.1.0 — 2018-07-20
- 2.0.0 — 2017-06-28
- 1.0.0 — 2017-03-19
- 0.1.0 — 2017-02-26

## README

# Isomorphic Unfetch

Switches between [unfetch](https://github.com/developit/unfetch) & [node-fetch](https://github.com/bitinn/node-fetch) for client & server.

## Install

This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed.

> **Note:** This module uses node-fetch 3.x, which is ES Module and requires Node >= 12.20.0.

```sh
$ npm i isomorphic-unfetch
```

Then with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.js.org/), use as you would anything else:

```javascript
// using ES6 modules
import fetch from "isomorphic-unfetch";

// using CommonJS modules
const fetch = require("isomorphic-unfetch");
```

## Usage

As a [**ponyfill**](https://ponyfill.com):

```js
import fetch from "isomorphic-unfetch";

fetch("/foo.json")
  .then((r) => r.json())
  .then((data) => {
    console.log(data);
  });
```

Globally, as a [**polyfill**](https://ponyfill.com/#polyfill):

```js
import "isomorphic-unfetch";

// "fetch" is now installed globally if it wasn't already available

fetch("/foo.json")
  .then((r) => r.json())
  .then((data) => {
    console.log(data);
  });
```

## License

[MIT License](LICENSE.md) © [Jason Miller](https://jasonformat.com/)

---
_Source: https://npm.io/package/isomorphic-unfetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
