1.0.0 • Published 1 year ago
read-entire-stream v1.0.0
read-entire-stream
Reads an entire stream's contents into a buffer.
Requires Node.js 16+
Why
There are other options. Why this one?
A brief survey of NPM packages that more or less do this were:
- Antiquated and unmaintained
- Overly verbose
- Included one or more dependencies of unknown security status
- Do not support ES6
This package has no dependencies and was written with ES6 in mind.
In a mere 7 lines of code, it will take any Node.js ReadableStream and return a Promise that resolves to a Node.js Buffer.
Installation
With NPM:
$ npm install --save read-entire-stream
With Yarn:
$ yarn add read-entire-stream
Usage
import readEntireStream from 'read-entire-stream'
// ...
const buf = await readEntireStream(stream)
Demo
See bin/echo
$ echo "Hello, world" | bin/echo
Hello, world
License
MIT License
1.0.0
1 year ago