SubscribableStream class

An extension of Duplex that operates in conjunction with a PayloadAssembler to convert raw bytes into a consumable form.

Extends

Duplex

Constructors

SubscribableStream(DuplexOptions)

Initializes a new instance of the SubscribableStream class.

Properties

length

Inherited Properties

defaultMaxListeners
readable
readableFlowing
readableHighWaterMark
readableLength
writable
writableHighWaterMark
writableLength

Methods

subscribe((chunk: any) => void)

Subscribes to the stream when receives data.

Inherited Methods

addListener("close", () => void)

Event emitter The defined events on documents including:

  1. close
  2. data
  3. end
  4. readable
  5. error
addListener("data", (chunk: any) => void)
addListener("end", () => void)
addListener("error", (err: Error) => void)
addListener("readable", () => void)
addListener(string | symbol, (args: any[]) => void)
cork()
destroy(Error)
emit("close")
emit("data", any)
emit("end")
emit("error", Error)
emit("readable")
emit(string | symbol, any[])
end(() => void)
end(any, () => void)
end(any, string, () => void)
eventNames()
getMaxListeners()
isPaused()
listenerCount(EventEmitter, string | symbol)
listenerCount(string | symbol)
listeners(string | symbol)
off(string | symbol, (args: any[]) => void)
on("close", () => void)
on("data", (chunk: any) => void)
on("end", () => void)
on("error", (err: Error) => void)
on("readable", () => void)
on(string | symbol, (args: any[]) => void)
once("close", () => void)
once("data", (chunk: any) => void)
once("end", () => void)
once("error", (err: Error) => void)
once("readable", () => void)
once(NodeEventTarget, string | symbol)
once(string | symbol, (args: any[]) => void)
pause()
pipe<T>(T, { end?: boolean })
prependListener("close", () => void)
prependListener("data", (chunk: any) => void)
prependListener("end", () => void)
prependListener("error", (err: Error) => void)
prependListener("readable", () => void)
prependListener(string | symbol, (args: any[]) => void)
prependOnceListener("close", () => void)
prependOnceListener("data", (chunk: any) => void)
prependOnceListener("end", () => void)
prependOnceListener("error", (err: Error) => void)
prependOnceListener("readable", () => void)
prependOnceListener(string | symbol, (args: any[]) => void)
push(any, string)
rawListeners(string | symbol)
read(number)
removeAllListeners(string | symbol)
removeListener("close", () => void)
removeListener("data", (chunk: any) => void)
removeListener("end", () => void)
removeListener("error", (err: Error) => void)
removeListener("readable", () => void)
removeListener(string | symbol, (args: any[]) => void)
resume()
setDefaultEncoding(string)
setEncoding(string)
setMaxListeners(number)
uncork()
unpipe(WritableStream)
unshift(any)
wrap(ReadableStream)
write(any, (error: Error | null | undefined) => void)
write(any, string, (error: Error | null | undefined) => void)

Constructor Details

SubscribableStream(DuplexOptions)

Initializes a new instance of the SubscribableStream class.

new SubscribableStream(options?: DuplexOptions)

Parameters

options

DuplexOptions

The DuplexOptions to use when constructing this stream.

Property Details

length

length: number

Property Value

number

Inherited Property Details

defaultMaxListeners

static defaultMaxListeners: number

Property Value

number

Inherited From EventEmitter.defaultMaxListeners

readable

readable: boolean

Property Value

boolean

Inherited From Readable.readable

readableFlowing

readableFlowing: boolean | null

Property Value

boolean | null

Inherited From Readable.readableFlowing

readableHighWaterMark

readableHighWaterMark: number

Property Value

number

Inherited From Readable.readableHighWaterMark

readableLength

readableLength: number

Property Value

number

Inherited From Readable.readableLength

writable

writable: boolean

Property Value

boolean

Inherited From Duplex.writable

writableHighWaterMark

writableHighWaterMark: number

Property Value

number

Inherited From Duplex.writableHighWaterMark

writableLength

writableLength: number

Property Value

number

Inherited From Duplex.writableLength

Method Details

subscribe((chunk: any) => void)

Subscribes to the stream when receives data.

function subscribe(onData: (chunk: any) => void)

Parameters

onData

(chunk: any) => void

Callback to be called when onData is executed.

Inherited Method Details

addListener("close", () => void)

Event emitter The defined events on documents including:

  1. close
  2. data
  3. end
  4. readable
  5. error
function addListener(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.addListener

addListener("data", (chunk: any) => void)

function addListener(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.addListener

addListener("end", () => void)

function addListener(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.addListener

addListener("error", (err: Error) => void)

function addListener(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.addListener

addListener("readable", () => void)

function addListener(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.addListener

addListener(string | symbol, (args: any[]) => void)

function addListener(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.addListener

cork()

function cork()

Inherited From Duplex.cork

destroy(Error)

function destroy(error?: Error)

Parameters

error

Error

Inherited From Readable.destroy

emit("close")

function emit(event: "close"): boolean

Parameters

event

"close"

Returns

boolean

Inherited From Readable.emit

emit("data", any)

function emit(event: "data", chunk: any): boolean

Parameters

event

"data"

chunk

any

Returns

boolean

Inherited From Readable.emit

emit("end")

function emit(event: "end"): boolean

Parameters

event

"end"

Returns

boolean

Inherited From Readable.emit

emit("error", Error)

function emit(event: "error", err: Error): boolean

Parameters

event

"error"

err

Error

Returns

boolean

Inherited From Readable.emit

emit("readable")

function emit(event: "readable"): boolean

Parameters

event

"readable"

Returns

boolean

Inherited From Readable.emit

emit(string | symbol, any[])

function emit(event: string | symbol, args: any[]): boolean

Parameters

event

string | symbol

args

any[]

Returns

boolean

Inherited From Readable.emit

end(() => void)

function end(cb?: () => void)

Parameters

cb

() => void

Inherited From Duplex.end

end(any, () => void)

function end(chunk: any, cb?: () => void)

Parameters

chunk

any

cb

() => void

Inherited From Duplex.end

end(any, string, () => void)

function end(chunk: any, encoding?: string, cb?: () => void)

Parameters

chunk

any

encoding

string

cb

() => void

Inherited From Duplex.end

eventNames()

function eventNames(): Array<string | symbol>

Returns

Array<string | symbol>

Inherited From EventEmitter.eventNames

getMaxListeners()

function getMaxListeners(): number

Returns

number

Inherited From EventEmitter.getMaxListeners

isPaused()

function isPaused(): boolean

Returns

boolean

Inherited From Readable.isPaused

listenerCount(EventEmitter, string | symbol)

Warning

This API is now deprecated.

since v4.0.0

static function listenerCount(emitter: EventEmitter, event: string | symbol): number

Parameters

emitter

EventEmitter

event

string | symbol

Returns

number

Inherited From EventEmitter.listenerCount

listenerCount(string | symbol)

function listenerCount(type: string | symbol): number

Parameters

type

string | symbol

Returns

number

Inherited From EventEmitter.listenerCount

listeners(string | symbol)

function listeners(event: string | symbol): Function[]

Parameters

event

string | symbol

Returns

Function[]

Inherited From EventEmitter.listeners

off(string | symbol, (args: any[]) => void)

function off(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From EventEmitter.off

on("close", () => void)

function on(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.on

on("data", (chunk: any) => void)

function on(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.on

on("end", () => void)

function on(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.on

on("error", (err: Error) => void)

function on(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.on

on("readable", () => void)

function on(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.on

on(string | symbol, (args: any[]) => void)

function on(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.on

once("close", () => void)

function once(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.once

once("data", (chunk: any) => void)

function once(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.once

once("end", () => void)

function once(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.once

once("error", (err: Error) => void)

function once(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.once

once("readable", () => void)

function once(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.once

once(NodeEventTarget, string | symbol)

static function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>

Parameters

emitter

NodeEventTarget

event

string | symbol

Returns

Promise<any[]>

Inherited From EventEmitter.once

once(string | symbol, (args: any[]) => void)

function once(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.once

pause()

function pause(): this

Returns

this

Inherited From Readable.pause

pipe<T>(T, { end?: boolean })

function pipe<T>(destination: T, options?: { end?: boolean }): T

Parameters

destination

T

options

{ end?: boolean }

Returns

T

Inherited From internal.pipe

prependListener("close", () => void)

function prependListener(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.prependListener

prependListener("data", (chunk: any) => void)

function prependListener(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.prependListener

prependListener("end", () => void)

function prependListener(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.prependListener

prependListener("error", (err: Error) => void)

function prependListener(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.prependListener

prependListener("readable", () => void)

function prependListener(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.prependListener

prependListener(string | symbol, (args: any[]) => void)

function prependListener(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.prependListener

prependOnceListener("close", () => void)

function prependOnceListener(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.prependOnceListener

prependOnceListener("data", (chunk: any) => void)

function prependOnceListener(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.prependOnceListener

prependOnceListener("end", () => void)

function prependOnceListener(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.prependOnceListener

prependOnceListener("error", (err: Error) => void)

function prependOnceListener(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.prependOnceListener

prependOnceListener("readable", () => void)

function prependOnceListener(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.prependOnceListener

prependOnceListener(string | symbol, (args: any[]) => void)

function prependOnceListener(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.prependOnceListener

push(any, string)

function push(chunk: any, encoding?: string): boolean

Parameters

chunk

any

encoding

string

Returns

boolean

Inherited From Readable.push

rawListeners(string | symbol)

function rawListeners(event: string | symbol): Function[]

Parameters

event

string | symbol

Returns

Function[]

Inherited From EventEmitter.rawListeners

read(number)

function read(size?: number): any

Parameters

size

number

Returns

any

Inherited From Readable.read

removeAllListeners(string | symbol)

function removeAllListeners(event?: string | symbol): this

Parameters

event

string | symbol

Returns

this

Inherited From EventEmitter.removeAllListeners

removeListener("close", () => void)

function removeListener(event: "close", listener: () => void): this

Parameters

event

"close"

listener

() => void

Returns

this

Inherited From Readable.removeListener

removeListener("data", (chunk: any) => void)

function removeListener(event: "data", listener: (chunk: any) => void): this

Parameters

event

"data"

listener

(chunk: any) => void

Returns

this

Inherited From Readable.removeListener

removeListener("end", () => void)

function removeListener(event: "end", listener: () => void): this

Parameters

event

"end"

listener

() => void

Returns

this

Inherited From Readable.removeListener

removeListener("error", (err: Error) => void)

function removeListener(event: "error", listener: (err: Error) => void): this

Parameters

event

"error"

listener

(err: Error) => void

Returns

this

Inherited From Readable.removeListener

removeListener("readable", () => void)

function removeListener(event: "readable", listener: () => void): this

Parameters

event

"readable"

listener

() => void

Returns

this

Inherited From Readable.removeListener

removeListener(string | symbol, (args: any[]) => void)

function removeListener(event: string | symbol, listener: (args: any[]) => void): this

Parameters

event

string | symbol

listener

(args: any[]) => void

Returns

this

Inherited From Readable.removeListener

resume()

function resume(): this

Returns

this

Inherited From Readable.resume

setDefaultEncoding(string)

function setDefaultEncoding(encoding: string): this

Parameters

encoding

string

Returns

this

Inherited From Duplex.setDefaultEncoding

setEncoding(string)

function setEncoding(encoding: string): this

Parameters

encoding

string

Returns

this

Inherited From Readable.setEncoding

setMaxListeners(number)

function setMaxListeners(n: number): this

Parameters

n

number

Returns

this

Inherited From EventEmitter.setMaxListeners

uncork()

function uncork()

Inherited From Duplex.uncork

unpipe(WritableStream)

function unpipe(destination?: WritableStream): this

Parameters

destination

WritableStream

Returns

this

Inherited From Readable.unpipe

unshift(any)

function unshift(chunk: any)

Parameters

chunk

any

Inherited From Readable.unshift

wrap(ReadableStream)

function wrap(oldStream: ReadableStream): this

Parameters

oldStream

ReadableStream

Returns

this

Inherited From Readable.wrap

write(any, (error: Error | null | undefined) => void)

function write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean

Parameters

chunk

any

cb

(error: Error | null | undefined) => void

Returns

boolean

Inherited From Duplex.write

write(any, string, (error: Error | null | undefined) => void)

function write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean

Parameters

chunk

any

encoding

string

cb

(error: Error | null | undefined) => void

Returns

boolean

Inherited From Duplex.write