1.0.9 • Published 6 years ago

@guseyn/cutie-stream v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

cutie-stream

NPM Version Build Status codecov

Cutie extension for stream module in Node. It's based on the Async Tree Pattern.

Examples

You can find examples of using this library in the test directory.

Install

npm install @cuties/stream

Run test

npm test

Run build

npm run build

Usage

const {
  // Needed async objects here from the table below
} = require('@cuties/stream');

For more information about parameters in the async objects visit docs of Node for stream module.

readable (here stream is readalbe)

Async ObjectAsync/sync callParameters(default value/description)Representation result
DestroyedReadablestream.destroystream, errorstream
IsPausedstream.isPausedstreamboolean
PausedReadablestream.pausestreamstream
PipedReadablestream.pipestream, destination, options({end: true})stream
ReadDataFromReadablereadstream, size, limit(if true then it reads only the first chunk(with size as specified second argument), it's false by default)string\|Buffer\|null
ReadableHighWaterMarkstream.readableHighWaterMarkstreamstream
ReadableWithCloseEventstream.on('close', event)stream, event(Event with definedBody())stream
ReadableWithDataEventstream.on('data', event)stream, event(Event with definedBody(chunk))stream
ReadableWithEncodingstream.setEncodingstream, encodingstream
ReadableWithEndEventstream.on('end', event)stream, event(Event with definedBody())stream
ReadableWithErrorEventstream.on('error', event)stream, event(Event with definedBody(error))stream
ReadableWithReadableEventstream.on('readable', event)stream, event(Event with definedBody())stream
ResumedReadablestream.resumestreamstream
UnpipedReadablestream.unpipestream, destinationstream
UnshiftedReadablestream.unshiftstream, chunkstream

writable (here stream is writable)

Async ObjectAsync/sync callParameters(default value/description)Representation result
CorkedWritablestream.corkstreamstream
DestroyedWritablestream.destroystream, errorstream
EndedWritablestream.endstream, chunk, encodingstream
UncorkedWritablestream.uncorkstreamstream
WritableHighWaterMarkstream.writableHighWaterMarkstreamstream
WritableWithCloseEventstream.on('close', event)stream, event(Event with definedBody())stream
WritableWithDefaultEncodingstream.setDefaultEncodingstream, encodingstream
WritableWithErrorEventstream.on('error', event)stream, event(Event with definedBody(error))stream
WritableWithFinishEventstream.on('finish', event)stream, event(Event with definedBody())stream
WritableWithOneTimeDrainEventstream.once('drain', event)stream, event(Event with definedBody())stream
WritableWithPipeEventstream.on('pipe', event)stream, event(Event with definedBody(src))stream
WritableWithUnpipeEventstream.on('unpipe', event)stream, event(Event with definedBody(src))stream
WrittenWritablestream.writestream, chunk, encodingstream

duplex (both readable and writeable)

Async ObjectAsync/sync callParameters(default value/description)Representation result
DestroyedStreamstream.destroystream, errorstream
PausedStreamstream.pausestreamstream
StreamWithCloseEventstream.on('close', event)stream, event(Event with definedBody())stream
StreamWithDataEventstream.on('data', event)stream, event(Event with definedBody(chunk))stream
StreamWithEncodingstream.setEncodingstream, encodingstream
StreamWithEndEventstream.on('end', event)stream, event(Event with definedBody())stream
StreamWithErrorEventstream.on('error', event)stream, event(Event with definedBody(error))stream
StreamWithReadableEventstream.on('readable', event)stream, event(Event with definedBody())stream
ReadDataFromStreamreadstream, size, limit(if true then it reads only the first chunk(with size as specified second argument), it's false by default)string\|Buffer\|null
ResumedStreamstream.resumestreamstream
StreamReadablestream.unpipestream, destinationstream
StreamReadablestream.unshiftstream, chunkstream
CorkedStreamstream.corkstreamstream
UncorkedStreamstream.uncorkstreamstream
StreamWithDefaultEncodingstream.setDefaultEncodingstream, encodingstream
StreamWithFinishEventstream.on('finish', event)stream, event(Event with definedBody())stream
StreamWithOneTimeDrainEventstream.once('drain', event)stream, event(Event with definedBody())stream
StreamWithPipeEventstream.on('pipe', event)stream, event(Event with definedBody(src))stream
StreamWithUnpipeEventstream.on('unpipe', event)stream, event(Event with definedBody(src))stream