import * as ez from 'ez-streams'
-
ez.writer.decorate(proto)
Adds the EZ streams writer API to an object. Usually the object is a prototype but it may be any object with awrite(_, data)
method.
You do not need to call this function if you create your readers with theez.devices
modules.
Returnsproto
for convenience. -
writer = writer.writeAll(_, val)
writesval
and ends the writer -
writer = writer.stop(_, err)
stops the writer.
by default err is silently ignored -
writer = writer.end()
ends the writer - compatiblity call (errors won't be thrown to caller) -
writer = writer.pre.action(fn)
returns another writer which appliesaction(fn)
before writing to the original writer.
action
may be any chainable action from the reader API:map
,filter
,transform
, ... -
stream = writer.nodify()
converts the writer into a native node Writable stream.