# stream-to-blob

> Convert a Readable Stream to a Blob

Latest version **2.0.1** (published 2020-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-to-blob
pnpm add stream-to-blob
yarn add stream-to-blob
bun add stream-to-blob
```

## 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 | 2.0.1 |
| Published | 2020-05-10 |
| First published | 2016-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/stream-to-blob) |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Feross Aboukhadijeh |
| Maintainers | feross |
| Keywords | blob, buffer, convert, convert stream to blob, length, name, stream |

## Links

- npm: https://www.npmjs.com/package/stream-to-blob
- Repository: https://github.com/feross/stream-to-blob
- Issues: https://github.com/feross/stream-to-blob/issues
- Funding: https://github.com/sponsors/feross
- npm.io page: https://npm.io/package/stream-to-blob

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2020-05-10
- 2.0.0 — 2019-07-10
- 1.0.2 — 2019-06-28
- 1.0.1 — 2018-06-09
- 1.0.0 — 2016-06-15

## README

# stream-to-blob [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[travis-image]: https://img.shields.io/travis/feross/stream-to-blob/master.svg
[travis-url]: https://travis-ci.org/feross/stream-to-blob
[npm-image]: https://img.shields.io/npm/v/stream-to-blob.svg
[npm-url]: https://npmjs.org/package/stream-to-blob
[downloads-image]: https://img.shields.io/npm/dm/stream-to-blob.svg
[downloads-url]: https://npmjs.org/package/stream-to-blob
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Convert a Readable Stream to a Blob

[![Sauce Test Status](https://saucelabs.com/browser-matrix/stream-to-blob.svg)](https://saucelabs.com/u/stream-to-blob)

This package converts a Readable Stream into a Blob.

This package is used by [WebTorrent](https://webtorrent.io).

## install

```
npm install stream-to-blob
```

## usage

```js
const streamToBlob = require('stream-to-blob')

const stream = new stream.Readable() // any Node.js readable stream
const blob = await streamToBlob(stream)
```

## api

### promise = streamToBlob(stream, [mimeType])

Convert the given readable stream, `stream`, into a W3C `Blob`. If `mimeType` is provided, then the `Blob` will have its mime type set to that value.

Returns a `Promise` which resolves to a `Blob` object on success. Otherwise, rejects with an `Error`.

## license

MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org).

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