API - RaddishStream

This object is a wrapper around streams and promises, this makes it easy to cast a value to a Stream and cast a stream to a promise. Also it adds a convenient transform method.

Methods

The cast method will cast any value to a Stream, after this a RaddishStream object will be returned.

Parameters
Name Type Description
object * The value to be cast to a stream.

Returns RaddishStream: The RaddishStream object used for chaining.

This method is a proxy between the RaddishStream object and it containing stream. This method therefor works the same as any other .on method.

Parameters
Name Type Description
event String The event which to listen to.
action Function The action to do in the event.

Returns RaddishStream: The RaddishStream object used for chaining.

This method is a proxy for the pipe method, this will bind its destination to the contained stream.

Parameters
Name Type Description
destination Object The destination stream to pipe to.

Returns RaddishStream: The RaddishStream object used for chaining.

This method converts the stream to a promise.

Returns Promise: The resolved or rejected promise.

This method adds a stream as its source. If the source is a RaddishStream its containing stream will be used.

Parameters
Name Type Description
stream * The stream to use as the source.

Returns RaddishStream: The RaddishStream object itself.

The transform method is a convenient wrapper for a transformation.

Parameters
Name Type Description
transform Function The function which to execute on each chunk for its transformation.
flush Function The last chunk to send after all the transformations.
objectMode Boolean To force objectMode.

Returns RaddishStream: The RaddishStream object itself used for chaining.