# nodeify-fetch

> Node streams for fetch

Latest version **3.1.0** (published 2022-10-02) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2022-10-02 |
| First published | 2016-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | fetch, readable, stream |

## Links

- npm: https://www.npmjs.com/package/nodeify-fetch
- Repository: https://github.com/bergos/nodeify-fetch
- Issues: https://github.com/bergos/nodeify-fetch/issues
- npm.io page: https://npm.io/package/nodeify-fetch

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.2.10
- [stream-chunks](https://npm.io/package/stream-chunks.md) ^1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^4.2.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2022-10-02
- 3.0.0 — 2021-10-09
- 2.2.2 — 2021-10-07
- 2.2.1 — 2020-04-03
- 2.2.0 — 2020-01-21
- 2.1.0 — 2019-12-12
- 2.0.0 — 2017-10-18
- 1.0.1 — 2017-04-24
- 1.0.0 — 2017-04-24
- 0.2.0 — 2017-03-20
- 0.1.2 — 2016-10-09
- 0.1.1 — 2016-08-20
- 0.1.0 — 2016-08-19

## README

# nodeify-fetch
[![build status](https://img.shields.io/github/workflow/status/bergos/nodeify-fetch/Test)](https://github.com/bergos/nodeify-fetch/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/nodeify-fetch.svg)](https://www.npmjs.com/package/nodeify-fetch)

The `nodeify-fetch` package provides a Node.js [Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) stream interface for [fetch](https://fetch.spec.whatwg.org/).
In the browser, the built-in fetch is used.
In a Node.js environment, `node-fetch` it's used.

Since version 3.0, this packages is [ESM](https://nodejs.org/api/esm.html) only.
Check version 2.x if you are looking for a CommonJS package.

## Usage

The only difference to the fetch standard is the `.body` property.
`nodeify-fetch` patches the `.body` to a readable stream: 

```javascript
import { promisify } from 'util'
import fetch from 'nodeify-fetch'
import { finished } from 'readable-stream'

async function main () {
  const res = await fetch('http://worldtimeapi.org/api/timezone/etc/UTC')

  if (!res.ok) {
    console.log(`error ${res.statusText}(${res.status})`)
  }

  res.body.on('data', chunk => console.log(chunk.toString()))

  await promisify(finished)(res.body)
}

main()
```

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