Skip to content

thenativeweb/streamtoarray

Repository files navigation

streamtoarray

streamtoarray converts streams to arrays.

Status

Category Status
Version npm
Dependencies David
Dev dependencies David
Build GitHub Actions
License GitHub

Installation

$ npm install streamtoarray

Quick start

First you need to integrate streamtoarray into your application:

const { toArray } = require('streamtoarray');

If you use TypeScript, use the following code instead:

import { toArray } from 'streamtoarray';

Then you can call toArray with a stream. The stream gets converted and its contents are returned as an array once the stream has ended:

const array = await toArray(stream);

If the stream emits an error event, an exception is thrown, and the partially parsed array is provided as the array property of the exception:

try {
  const array = await toArray(stream);
} catch (ex) {
  console.log(ex.array);

  // ...
}

Running quality assurance

To run quality assurance for this module use roboter:

$ npx roboter

About

streamtoarray converts a stream to an array.

Resources

License

Stars

Watchers

Forks

Packages

No packages published