# isomorphic-fetch

> Isomorphic WHATWG Fetch API, for Node & Browserify

Latest version **3.0.0** (published 2020-09-23) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-09-23 |
| First published | 2014-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/isomorphic-fetch) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6905 |
| Author | Matt Andrews |
| Maintainers | mattandrews, the-ft |

## Links

- npm: https://www.npmjs.com/package/isomorphic-fetch
- Repository: https://github.com/matthew-andrews/isomorphic-fetch
- Homepage: https://github.com/matthew-andrews/isomorphic-fetch/issues
- Issues: https://github.com/matthew-andrews/isomorphic-fetch/issues
- npm.io page: https://npm.io/package/isomorphic-fetch

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) ^3.4.1

## Recent versions

- 3.0.0 (latest) — 2020-09-23
- 2.2.1 — 2016-01-15
- 2.2.0 — 2015-10-20
- 2.1.1 — 2015-07-16
- 2.1.0 — 2015-05-21
- 2.0.2 — 2015-04-15
- 2.0.1 — 2015-04-06
- 2.0.0 — 2015-02-10
- 1.7.0 — 2015-01-27
- 1.6.1 — 2015-01-26
- 1.6.0 — 2015-01-24
- 1.5.2 — 2015-01-23
- 1.5.1 — 2015-01-23
- 1.5.0 — 2015-01-23
- 1.4.0 — 2015-01-21
- … 8 more at https://npm.io/package/isomorphic-fetch/versions

## README

isomorphic-fetch [![Build Status](https://travis-ci.org/matthew-andrews/isomorphic-fetch.svg?branch=master)](https://travis-ci.org/matthew-andrews/isomorphic-fetch)
================

Fetch for node and Browserify.  Built on top of [GitHub's WHATWG Fetch polyfill](https://github.com/github/fetch).

## Warnings

- This adds `fetch` as a global so that its API is consistent between client and server.

For [ease-of-maintenance and backward-compatibility reasons][why polyfill], this library will always be a polyfill. As a "safe" alternative, which does not modify the global, consider [fetch-ponyfill][].

[why polyfill]: https://github.com/matthew-andrews/isomorphic-fetch/issues/31#issuecomment-149668361
[fetch-ponyfill]: https://github.com/qubyte/fetch-ponyfill

## Why Use Isomorphic Fetch

The Fetch API is currently [not implemented consistently](http://caniuse.com/#search=fetch) across browsers. This module will enable you to use `fetch` in your Node code in a cross-browser compliant fashion. The Fetch API is part of the Web platform API defined by the standards bodies WHATWG and W3C.

## Installation

### NPM

```sh
npm install --save isomorphic-fetch
```

### Bower

```sh
bower install --save isomorphic-fetch
```

## Usage

```js
require('isomorphic-fetch');

fetch('//offline-news-api.herokuapp.com/stories')
	.then(function(response) {
		if (response.status >= 400) {
			throw new Error("Bad response from server");
		}
		return response.json();
	})
	.then(function(stories) {
		console.log(stories);
	});
```

## License

All open source code released by FT Labs is licenced under the MIT licence.  Based on [the fine work by](https://github.com/github/fetch/pull/31) **[jxck](https://github.com/Jxck)**.

## Alternatives

- [cross-fetch](https://github.com/lquixada/cross-fetch#why-not-isomorphic-fetch)
- Using [node-fetch](https://github.com/node-fetch/node-fetch) and the [Fetch polyfill](https://github.com/github/fetch) directly (or from [polyfill.io](https://polyfill.io), or relying on [the browser's implementation of the Fetch API](https://caniuse.com/fetch)).

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