tranquil-stream

Working with streams, keeping it simple.

Usage no npm install needed!

<script type="module">
  import tranquilStream from 'https://cdn.skypack.dev/tranquil-stream';
</script>

README

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