Module

Pipes.Node.Stream

Package
purescript-node-stream-pipes
Repository
cakekindel/purescript-node-stream-pipes

#fromReadable Source

fromReadable :: forall s a m. MonadThrow Error m => MonadAff m => Read s a => s -> Producer_ (Maybe a) m Unit

Convert a Readable stream to a Pipe.

This will yield Nothing before exiting, signaling End-of-stream.

#fromWritable Source

fromWritable :: forall s a m. MonadThrow Error m => MonadAff m => Write s a => s -> Consumer (Maybe a) m Unit

Convert a Writable stream to a Pipe.

When Nothing is piped to this, the stream will be ended, and the pipe will noop if invoked again.

#fromTransform Source

fromTransform :: forall a b m. MonadThrow Error m => MonadAff m => Transform a b -> Pipe (Maybe a) (Maybe b) m Unit

Convert a Transform stream to a Pipe.

When Nothing is piped to this, the Transform stream will be ended, and the pipe will noop if invoked again.

#withEOS Source

withEOS :: forall a m. Monad m => Producer a m Unit -> Producer (Maybe a) m Unit

Given a Producer of values, wrap them in Just.

Before the Producer exits, emits Nothing as an End-of-stream signal.

#unEOS Source

unEOS :: forall a m. Monad m => Pipe (Maybe a) a m Unit

Strip a pipeline of the EOS signal

#inEOS Source

inEOS :: forall a b m. MonadRec m => Pipe a b m Unit -> Pipe (Maybe a) (Maybe b) m Unit

Lift a Pipe a a to Pipe (Maybe a) (Maybe a).

Allows easily using pipes not concerned with the EOS signal with pipes that do need this signal.

(ex. Pipes.Node.Buffer.toString doesn't need an EOS signal, but Pipes.Node.FS.create does.)

Just values will be passed to the pipe, and the response(s) will be wrapped in Just.

Nothing will bypass the given pipe entirely, and the pipe will not be invoked again.