# portable-fetch

> Isomorphic WHATWG Fetch API, for Node, Browserify, Webpack & React-Native

Latest version **3.0.0** (published 2017-07-05) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2017-07-05 |
| First published | 2017-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Matt Andrews |
| Maintainers | sethdenner |

## Links

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

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^1.0.1
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) >=0.10.0

## Recent versions

- 3.0.0 (latest) — 2017-07-05
- 2.3.0 — 2017-06-30

## 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. Also works in Webpack and React-Native 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.
- You must bring your own ES6 Promise compatible polyfill, I suggest [es6-promise](https://github.com/jakearchibald/es6-promise).

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

## Installation

### NPM

```sh
npm install --save portable-fetch es6-promise
```

## Usage

```js
require('es6-promise').polyfill();
require('portable-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)**.

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