@cuties/stream

1.2.1 • Public • Published

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 Object Async/sync call Parameters(default value/description) Representation result
DestroyedReadable stream.destroy stream, error stream
IsPaused stream.isPaused stream boolean
PausedReadable stream.pause stream stream
PipedReadable stream.pipe stream, destination, options({end: true}) stream
ReadDataFromReadable read stream, 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
ReadableHighWaterMark stream.readableHighWaterMark stream stream
ReadableWithCloseEvent stream.on('close', event) stream, event(Event with definedBody()) stream
ReadableWithDataEvent stream.on('data', event) stream, event(Event with definedBody(chunk)) stream
ReadableWithEncoding stream.setEncoding stream, encoding stream
ReadableWithEndEvent stream.on('end', event) stream, event(Event with definedBody()) stream
ReadableWithErrorEvent stream.on('error', event) stream, event(Event with definedBody(error)) stream
ReadableWithReadableEvent stream.on('readable', event) stream, event(Event with definedBody()) stream
ResumedReadable stream.resume stream stream
UnpipedReadable stream.unpipe stream, destination stream
UnshiftedReadable stream.unshift stream, chunk stream

writable (here stream is writable)

Async Object Async/sync call Parameters(default value/description) Representation result
CorkedWritable stream.cork stream stream
DestroyedWritable stream.destroy stream, error stream
EndedWritable stream.end stream, chunk, encoding stream
UncorkedWritable stream.uncork stream stream
WritableHighWaterMark stream.writableHighWaterMark stream stream
WritableWithCloseEvent stream.on('close', event) stream, event(Event with definedBody()) stream
WritableWithDefaultEncoding stream.setDefaultEncoding stream, encoding stream
WritableWithErrorEvent stream.on('error', event) stream, event(Event with definedBody(error)) stream
WritableWithFinishEvent stream.on('finish', event) stream, event(Event with definedBody()) stream
WritableWithOneTimeDrainEvent stream.once('drain', event) stream, event(Event with definedBody()) stream
WritableWithPipeEvent stream.on('pipe', event) stream, event(Event with definedBody(src)) stream
WritableWithUnpipeEvent stream.on('unpipe', event) stream, event(Event with definedBody(src)) stream
WrittenWritable stream.write stream, chunk, encoding stream

duplex (both readable and writeable)

Async Object Async/sync call Parameters(default value/description) Representation result
DestroyedStream stream.destroy stream, error stream
PausedStream stream.pause stream stream
StreamWithCloseEvent stream.on('close', event) stream, event(Event with definedBody()) stream
StreamWithDataEvent stream.on('data', event) stream, event(Event with definedBody(chunk)) stream
StreamWithEncoding stream.setEncoding stream, encoding stream
StreamWithEndEvent stream.on('end', event) stream, event(Event with definedBody()) stream
StreamWithErrorEvent stream.on('error', event) stream, event(Event with definedBody(error)) stream
StreamWithReadableEvent stream.on('readable', event) stream, event(Event with definedBody()) stream
ReadDataFromStream read stream, 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
ResumedStream stream.resume stream stream
StreamReadable stream.unpipe stream, destination stream
StreamReadable stream.unshift stream, chunk stream
CorkedStream stream.cork stream stream
UncorkedStream stream.uncork stream stream
StreamWithDefaultEncoding stream.setDefaultEncoding stream, encoding stream
StreamWithFinishEvent stream.on('finish', event) stream, event(Event with definedBody()) stream
StreamWithOneTimeDrainEvent stream.once('drain', event) stream, event(Event with definedBody()) stream
StreamWithPipeEvent stream.on('pipe', event) stream, event(Event with definedBody(src)) stream
StreamWithUnpipeEvent stream.on('unpipe', event) stream, event(Event with definedBody(src)) stream

Readme

Keywords

Package Sidebar

Install

npm i @cuties/stream

Weekly Downloads

4

Version

1.2.1

License

MIT

Unpacked Size

41.6 kB

Total Files

69

Last publish

Collaborators

  • guseyn