Readable

js.node.events.EventEmitterjs.node.Streamjs.node.stream.Readable (extern class) → js.node.fs.ReadStream, Duplex
See: https://nodejs.org/api/stream.html#stream_class_stream_readable

Instance Members

destroyed: Bool

Is true after readable.destroy() has been called.

See: https://nodejs.org/api/stream.html#stream_readable_destroyed

readable: Bool

Is true if it is safe to call readable.read().

See: https://nodejs.org/api/stream.html#stream_readable_readable

readableEncoding: Null<String>

Getter for the property encoding of a given Readable stream. The encoding property can be set using the readable.setEncoding() method.

See: https://nodejs.org/api/stream.html#stream_readable_readableencoding

readableEnded: Bool

Becomes true when 'end' event is emitted.

See: https://nodejs.org/api/stream.html#stream_readable_readableended

readableHighWaterMark: Int

Returns the value of highWaterMark passed when constructing this Readable.

See: https://nodejs.org/api/stream.html#stream_readable_readablehighwatermark

readableLength: Int

This property contains the number of bytes (or objects) in the queue ready to be read. The value provides introspection data regarding the status of the highWaterMark.

See: https://nodejs.org/api/stream.html#stream_readable_readablelength

readableObjectMode: Bool

Getter for the property objectMode of a given Readable stream.

See: https://nodejs.org/api/stream.html#stream_readable_readableobjectmode

isTTY: Bool

Terminal read streams (i.e. process.stdin) have this property set to true. It is false for any other read streams.

See: https://nodejs.org/api/tty.html#tty_readstream_istty

Destroy the stream. Optionally emit an 'error' event, and emit a 'close' event unless emitClose is set in false. After this call, the readable stream will release any internal resources and subsequent calls to push() will be ignored. Implementors should not override this method, but instead implement readable._destroy().

See: https://nodejs.org/api/stream.html#stream_readable_destroy_error
Name Type Default
error js.lib.Error (optional)
Returns
js.node.stream.Readable.TSelf

isPaused(): Bool

The readable.isPaused() method returns the current operating state of the Readable. This is used primarily by the mechanism that underlies the readable.pipe() method. In most typical cases, there will be no reason to use this method directly.

See: https://nodejs.org/api/stream.html#stream_readable_ispaused
Returns
Bool

The readable.pause() method will cause a stream in flowing mode to stop emitting 'data' events, switching out of flowing mode. Any data that becomes available will remain in the internal buffer.

See: https://nodejs.org/api/stream.html#stream_readable_pause
Returns
js.node.stream.Readable.TSelf

pipe(destination: pipe.T, ?options: AnonStruct): pipe.T

The readable.pipe() method attaches a Writable stream to the readable, causing it to switch automatically into flowing mode and push all of its data to the attached Writable. The flow of data will be automatically managed so that the destination Writable stream is not overwhelmed by a faster Readable stream.

See: https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
Name Type Default
destination pipe.T
options AnonStruct (optional)
Returns
pipe.T

read(?size: Int): Null<Dynamic>

The readable.read() method pulls some data out of the internal buffer and returns it. If no data available to be read, null is returned. By default, the data will be returned as a Buffer object unless an encoding has been specified using the readable.setEncoding() method or the stream is operating in object mode.

See: https://nodejs.org/api/stream.html#stream_readable_read_size
Name Type Default
size Int (optional)
Returns
Null<Dynamic>

The readable.resume() method causes an explicitly paused Readable stream to resume emitting 'data' events, switching the stream into flowing mode.

See: https://nodejs.org/api/stream.html#stream_readable_resume
Returns
js.node.stream.Readable.TSelf

setEncoding(encoding: String): js.node.stream.Readable.TSelf

The readable.setEncoding() method sets the character encoding for data read from the Readable stream.

See: https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding
Name Type
encoding String
Returns
js.node.stream.Readable.TSelf

The readable.unpipe() method detaches a Writable stream previously attached using the stream.pipe() method.

See: https://nodejs.org/api/stream.html#stream_readable_unpipe_destination
Name Type Default
destination IWritable (optional)
Returns
js.node.stream.Readable.TSelf

unshift(chunk: Null<Dynamic>, ?encoding: String): Void

Passing chunk as null signals the end of the stream (EOF), after which no more data can be written.

See: https://nodejs.org/api/stream.html#stream_readable_unshift_chunk_encoding
Name Type Default
chunk Null<Dynamic>
encoding String (optional)

wrap(stream: Dynamic): IReadable

Prior to Node.js 0.10, streams did not implement the entire stream module API as it is currently defined. (See Compatibility for more information.)

See: https://nodejs.org/api/stream.html#stream_readable_wrap_stream
Name Type
stream Dynamic
Returns
IReadable

push(chunk: Null<Dynamic>, ?encoding: String): Bool

The readable.push() method is intended be called only by Readable implementers, and only from within the readable._read() method.

See: https://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding
Name Type Default
chunk Null<Dynamic>
encoding String (optional)
Returns
Bool

new(?options: Null<ReadableNewOptions>): Void
See: https://nodejs.org/api/stream.html#stream_new_stream_readable_options
Name Type Default
options Null<ReadableNewOptions> (optional)

Metadata

Name Parameters
:jsRequire "stream", "Readable"