# extra-response

> Utilities for Response

Latest version **0.6.1** (published 2026-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install extra-response
pnpm add extra-response
yarn add extra-response
bun add extra-response
```

## Health

**Score 60/100 (C)** — status: stable.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.1 |
| Published | 2026-02-20 |
| First published | 2020-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |

## Links

- npm: https://www.npmjs.com/package/extra-response
- Repository: https://github.com/BlackGlory/extra-response
- Homepage: https://github.com/BlackGlory/extra-response#readme
- Issues: https://github.com/BlackGlory/extra-response/issues
- npm.io page: https://npm.io/package/extra-response

## Dependencies (2)

- [iterable-operator](https://npm.io/package/iterable-operator.md) ^5.1.0
- [@blackglory/prelude](https://npm.io/package/@blackglory/prelude.md) ^0.4.0

## Recent versions

- 0.6.1 (latest) — 2026-02-20
- 0.6.0 — 2025-09-23
- 0.5.2 — 2023-06-10
- 0.5.1 — 2023-01-22
- 0.5.0 — 2023-01-22
- 0.4.1 — 2023-01-21
- 0.4.0 — 2022-11-13
- 0.3.12 — 2022-11-03
- 0.3.11 — 2022-04-14
- 0.3.10 — 2022-03-19
- 0.3.9 — 2022-01-06
- 0.3.8 — 2021-11-08
- 0.3.7 — 2021-09-16
- 0.3.6 — 2021-07-12
- 0.3.5 — 2021-05-16
- … 24 more at https://npm.io/package/extra-response/versions

## README

# extra-response
Utilities for [Response].

[Response]: https://developer.mozilla.org/en-US/docs/Web/API/Response

## Install
```sh
npm install --save extra-response
# or
yarn add extra-response
```

## API
### ok
```ts
ok(res: Response): Promise<Response>
```

If `res.ok` is `false`, it will throw `HTTPError`.

### toJSON
```ts
toJSON(res: Response): Promise<Json>
```

### toText
```ts
toText(res: Response, charset?: string): Promise<string>
```

### toLines
```ts
toLines(
  res: Response
, newline: string = '\n'
): AsyncIterable<string>
```

Not available for `node-fetch`, because it is not provide the WHATWG `ReadableStream` as body.

### toNDJSON
```ts
toNDJSON(
  res: Response
, newline: string = '\n'
): AsyncIterable<Json>
```

Not available for `node-fetch`, because it is not provide the WHATWG `ReadableStream` as body.

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