SubscribableStream class
An extension of Duplex
that operates in conjunction with a PayloadAssembler
to convert raw bytes into a consumable form.
- Extends
-
Duplex
Constructors
Subscribable |
Initializes a new instance of the SubscribableStream class. |
Properties
length |
Inherited Properties
default |
|
readable | |
readable |
|
readable |
|
readable |
|
writable | |
writable |
|
writable |
Methods
subscribe((chunk: any) => void) | Subscribes to the stream when receives data. |
Inherited Methods
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:
- close
- data
- end
- readable
- 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