0.0.1 • Published 3 years ago

@zingle/stream v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Stream utility library for Node.js.

stream Module

To use the functions in this library, import the @zingle/stream package into your project.

import stream from "@zingle/stream";

Transform Streams

filter Stream

filter(filterFunction, streamOptions)

Use a filter stream to filter out stream data that fails to match a filter. This is analogous to Array.prototype.filter.

import stream from "@zingle/stream";

getReadableSomehow().pipe(stream.filter((chunk, enc) => {
  return chunk.toString("utf8") !== "null";
}));

flatten Stream

flatten(streamOptions)

Use a flatten stream to flatten stream Array data before passing it along. This is analogous to Array.prototype.flat.

import stream from "@zingle/stream";

getReadableSomehow().pipe(stream.flatten());

map Stream

map(mapFunction, streamOptions)

Use a map stream to perform a one-to-one mapping of stream data using a map function. This is analogous to Array.prototype.map.

import stream from "@zingle/stream";

getReadableSomehow().pipe(stream.map((chunk, enc) => {
  return chunk.toString("utf8").toUpperCase();
}));