@sealsystems/stream-as-string

0.2.4 • Public • Published

@sealsystems/stream-as-string

CircleCI AppVeyor

@sealsystems/stream-as-string transforms streams to strings.

Installation

$ npm install @sealsystems/stream-as-string

Quick start

First you need to add a reference to @sealsystems/stream-as-string within your application.

const StreamAsString = require('@sealsystems/stream-as-string');

Then use the write function to add data to the stream. Once you are done, call end. Afterwards, you may use the asString function to get the stringified stream.

const streamAsString = new StreamAsString();

streamAsString.write('foo');
streamAsString.write('bar');
streamAsString.end();

console.log(streamAsString.asString()); // => 'foobar'

Alternatively, you may listen to the as-string event. It is raised after the stream has been ended.

const streamAsString = new StreamAsString();

streamAsString.once('as-string', (asString) => {
  console.log(asString); // => 'foobar'
});

streamAsString.write('foo');
streamAsString.write('bar');
streamAsString.end();

Running the build

To build this module use roboter.

$ bot

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.4
    0
    • latest

Version History

Package Sidebar

Install

npm i @sealsystems/stream-as-string

Weekly Downloads

0

Version

0.2.4

License

MIT

Unpacked Size

5.93 kB

Total Files

5

Last publish

Collaborators

  • seal-mt
  • michaelscherer-seal
  • comgit
  • gel