@jorgeferrero/stream-to-buffer
Version:
A promise based npm package that converts a node.js ReadStream to buffer
36 lines (25 loc) • 1.07 kB
Markdown
# Stream To Buffer
[](https://travis-ci.org/jferrl/stream-to-buffer)
[](https://codeclimate.com/github/jferrl/stream-to-buffer/maintainability)
[](https://codeclimate.com/github/jferrl/stream-to-buffer/test_coverage)


A promise based Node.js package that converts a Node.js Readable to buffer
## Installation
```sh
npm i @jorgeferrero/stream-to-buffer
```
## Usage
```typescript
import { streamToBuffer } from '@jorgeferrero/stream-to-buffer';
import * as fs from 'fs';
const data = await streamToBuffer(fs.createReadStream('./file'));
console.log(data.toString());
```
```sh
Output should be the the content of the file
```
## Test
```sh
npm run test
```