0.1.0 • Published 4 years ago

tranquil-stream v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Tranquil Stream

Stream utilities to make quick results a little easier.

Installation

npm install --save tranquil-stream

Getting Started

Just require the module, every method lives at the top level.

Methods

bufferToStream(buffer)

Take a buffer object and make it into a Duplex stream.

const stream = bufferToStream(await fs.readFile('some/path/here.txt'));

jsonStreamToObject(stream)

Takes a stream object that contains stringified JSON data and parses it into an object (async).

const obj = await jsonStreamToObject(fs.createReadStream('my-json-file.json'));

// obj is just the exact, parsed json as an object