@futagoza/create-stream

Helpers to create through2 streams from different types of functions.

Usage no npm install needed!

<script type="module">
  import futagozaCreateStream from 'https://cdn.skypack.dev/@futagoza/create-stream';
</script>

README

This package provides helpers to create through2 streams from different types of functions.

const cs = require( "@futagoza/create-stream" );

// Create's a through2 stream from the given Promise or Function,
// passing the extra arguments fn if it's not a Promise.
cs( fn, ...args )
cs.createStream( fn, ...args )
cs.from( fn, ...args )

// Create's a through2 stream from the given Promise, passing the
// optional options object directly to through2.
cs.fromPromise( fn, options? )

// Create's a through2.obj tranform stream using the given function,
// passing the optional array of extra arguments to fn.
cs.fromFunction( fn, args? )

// Aliases for through, so it doesn't have to be included separately.
cs.through
cs.through2
cs.ctor
cs.obj

History license

@futagoza/create-stream is Copyright (c) 2018+ Futago-za Ryuu