Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jferrl/stream-to-buffer

A promise based npm package that converts a node.js ReadStream to buffer
https://github.com/jferrl/stream-to-buffer

js nodejs streaming typescript

Last synced: about 6 hours ago
JSON representation

A promise based npm package that converts a node.js ReadStream to buffer

Awesome Lists containing this project

README

        

# Stream To Buffer

[![Build Status](https://travis-ci.org/jferrl/stream-to-buffer.svg?branch=master)](https://travis-ci.org/jferrl/stream-to-buffer)
[![Maintainability](https://api.codeclimate.com/v1/badges/71b14075a12d34b2efbc/maintainability)](https://codeclimate.com/github/jferrl/stream-to-buffer/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/71b14075a12d34b2efbc/test_coverage)](https://codeclimate.com/github/jferrl/stream-to-buffer/test_coverage)
![npm](https://img.shields.io/npm/dw/@jorgeferrero/stream-to-buffer)
![npm (scoped)](https://img.shields.io/npm/v/@jorgeferrero/stream-to-buffer)

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
```