Node.Stream
- Package
- purescript-node-streams
- Repository
- purescript-node/purescript-node-streams
This module provides a low-level wrapper for the Node Stream API.
#onDataString Source
onDataString :: forall eff w. Readable w (exception :: EXCEPTION | eff) -> Encoding -> (String -> Eff (exception :: EXCEPTION | eff) Unit) -> Eff (exception :: EXCEPTION | eff) UnitListen for data events, returning data in a String, which will be
decoded using the given encoding. Note that this will fail if setEncoding
has been called on the stream.
#onDataEither Source
onDataEither :: forall eff r. Readable r (exception :: EXCEPTION | eff) -> (Either String Buffer -> Eff (exception :: EXCEPTION | eff) Unit) -> Eff (exception :: EXCEPTION | eff) UnitListen for data events, returning data in an Either String Buffer. This
function is provided for the (hopefully rare) case that setEncoding has
been called on the stream.
#setEncoding Source
setEncoding :: forall eff w. Readable w eff -> Encoding -> Eff eff UnitSet the encoding used to read chunks as strings from the stream. This function may be useful when you are passing a readable stream to some other JavaScript library, which already expects an encoding to be set.
Where possible, you should try to use onDataString instead of this
function.
#setDefaultEncoding Source
setDefaultEncoding :: forall eff r. Writable r eff -> Encoding -> Eff eff UnitSet the default encoding used to write strings to the stream. This function
is useful when you are passing a writable stream to some other JavaScript
library, which already expects a default encoding to be set. It has no
effect on the behaviour of the writeString function (because that
function ensures that the encoding is always supplied explicitly).
- Modules
- Node.
Stream