# buffer-to-stream

> convert buffer to readable stream

Latest version **1.0.0** (published 2017-08-15) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.0 |
| Published | 2017-08-15 |
| First published | 2017-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/buffer-to-stream) |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | creeperyang |
| Maintainers | creeper |
| Keywords | buffer, stream |

## Links

- npm: https://www.npmjs.com/package/buffer-to-stream
- Repository: https://github.com/creeperyang/buffer-to-stream
- Homepage: https://github.com/creeperyang/buffer-to-stream#readme
- Issues: https://github.com/creeperyang/buffer-to-stream/issues
- npm.io page: https://npm.io/package/buffer-to-stream

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-08-15

## README

[![Build Status](https://travis-ci.org/creeperyang/buffer-to-stream.svg?branch=master)](https://travis-ci.org/creeperyang/buffer-to-stream)
[![npm version](https://badge.fury.io/js/buffer-to-stream.svg)](https://badge.fury.io/js/buffer-to-stream)
[![Dependency Status](https://david-dm.org/creeperyang/buffer-to-stream.svg)](https://david-dm.org/creeperyang/buffer-to-stream)

# buffer-to-stream

> Convert buffer or string to readable stream.

[![NPM](https://nodei.co/npm/buffer-to-stream.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/buffer-to-stream/)

## Usage

```js
const toStream = require('buffer-to-stream')

const readable = toStream(Buffer.from('hello world!', 'utf8'))
readable.on('readable', () => {
  let chunk
  while ((chunk = reader.read()) !== null) {
    console.log('got data', chunk)
  }
})
readable.on('end', () => console.log('done'))
```

## API

**`toStream(buffer[, chunkSize])`**

- `buffer` is the source buffer or string, and the type is `String|Buffer`.
- `chunkSize` specifies stream data push chunk size, and type is `Number`.

And the return value is a readable stream.

## License

[MIT](/LICENSE)

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