Skip to content

Zingle/node-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();
}));

About

Node.js streams utility library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published