SubscribableStream class
Duplex
的延伸模組,會搭配 PayloadAssembler
運作,以將原始位元組轉換成消費型形式。
- Extends
-
Duplex
建構函式
Subscribable |
初始化 SubscribableStream 類別的新實例。 |
屬性
length |
繼承的屬性
default |
|
readable | |
readable |
|
readable |
|
readable |
|
writable | |
writable |
|
writable |
方法
subscribe((chunk: any) => void) | 接收數據時訂閱數據流。 |
繼承的方法
建構函式詳細資料
SubscribableStream(DuplexOptions)
初始化 SubscribableStream 類別的新實例。
new SubscribableStream(options?: DuplexOptions)
參數
- options
-
DuplexOptions
建構此數據流時要使用的 DuplexOptions
。
屬性詳細資料
length
length: number
屬性值
number
繼承的屬性詳細資料
defaultMaxListeners
static defaultMaxListeners: number
屬性值
number
繼承自 EventEmitter.defaultMaxListeners
readable
readable: boolean
屬性值
boolean
繼承自 Readable.readable
readableFlowing
readableFlowing: boolean | null
屬性值
boolean | null
繼承自 Readable.readableFlowing
readableHighWaterMark
readableHighWaterMark: number
屬性值
number
繼承自 Readable.readableHighWaterMark
readableLength
readableLength: number
屬性值
number
繼承自 Readable.readableLength
writable
writable: boolean
屬性值
boolean
繼承自 Duplex.writable
writableHighWaterMark
writableHighWaterMark: number
屬性值
number
繼承自 Duplex.writableHighWaterMark
writableLength
writableLength: number
屬性值
number
繼承自 Duplex.writableLength
方法詳細資料
subscribe((chunk: any) => void)
接收數據時訂閱數據流。
function subscribe(onData: (chunk: any) => void)
參數
- onData
-
(chunk: any) => void
執行 onData 時要呼叫的回呼。
繼承的方法的詳細資料
addListener("close", () => void)
事件發出器 檔案上定義的事件,包括:
- 關閉
- 數據
- 結束
- 讀
- 錯誤
function addListener(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.addListener
addListener("data", (chunk: any) => void)
function addListener(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.addListener
addListener("end", () => void)
function addListener(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.addListener
addListener("error", (err: Error) => void)
function addListener(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.addListener
addListener("readable", () => void)
function addListener(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.addListener
addListener(string | symbol, (args: any[]) => void)
function addListener(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.addListener
cork()
function cork()
繼承自 Duplex.cork
destroy(Error)
function destroy(error?: Error)
參數
- error
-
Error
繼承自 Readable.destroy
emit("close")
function emit(event: "close"): boolean
參數
- event
-
"close"
傳回
boolean
繼承自 Readable.emit
emit("data", any)
function emit(event: "data", chunk: any): boolean
參數
- event
-
"data"
- chunk
-
any
傳回
boolean
繼承自 Readable.emit
emit("end")
function emit(event: "end"): boolean
參數
- event
-
"end"
傳回
boolean
繼承自 Readable.emit
emit("error", Error)
function emit(event: "error", err: Error): boolean
參數
- event
-
"error"
- err
-
Error
傳回
boolean
繼承自 Readable.emit
emit("readable")
function emit(event: "readable"): boolean
參數
- event
-
"readable"
傳回
boolean
繼承自 Readable.emit
emit(string | symbol, any[])
function emit(event: string | symbol, args: any[]): boolean
參數
- event
-
string | symbol
- args
-
any[]
傳回
boolean
繼承自 Readable.emit
end(() => void)
function end(cb?: () => void)
參數
- cb
-
() => void
繼承自 Duplex.end
end(any, () => void)
function end(chunk: any, cb?: () => void)
參數
- chunk
-
any
- cb
-
() => void
繼承自 Duplex.end
end(any, string, () => void)
function end(chunk: any, encoding?: string, cb?: () => void)
參數
- chunk
-
any
- encoding
-
string
- cb
-
() => void
繼承自 Duplex.end
eventNames()
function eventNames(): Array<string | symbol>
傳回
Array<string | symbol>
繼承自 EventEmitter.eventNames
getMaxListeners()
function getMaxListeners(): number
傳回
number
繼承自 EventEmitter.getMaxListeners
isPaused()
function isPaused(): boolean
傳回
boolean
繼承自 Readable.isPaused
listenerCount(EventEmitter, string | symbol)
警告
此 API 現已淘汰。
since v4.0.0
static function listenerCount(emitter: EventEmitter, event: string | symbol): number
參數
- emitter
-
EventEmitter
- event
-
string | symbol
傳回
number
繼承自 EventEmitter.listenerCount
listenerCount(string | symbol)
function listenerCount(type: string | symbol): number
參數
- type
-
string | symbol
傳回
number
繼承自 EventEmitter.listenerCount
listeners(string | symbol)
function listeners(event: string | symbol): Function[]
參數
- event
-
string | symbol
傳回
Function[]
繼承自 EventEmitter.listeners
off(string | symbol, (args: any[]) => void)
function off(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 EventEmitter.off
on("close", () => void)
function on(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.on
on("data", (chunk: any) => void)
function on(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.on
on("end", () => void)
function on(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.on
on("error", (err: Error) => void)
function on(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.on
on("readable", () => void)
function on(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.on
on(string | symbol, (args: any[]) => void)
function on(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.on
once("close", () => void)
function once(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.once
once("data", (chunk: any) => void)
function once(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.once
once("end", () => void)
function once(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.once
once("error", (err: Error) => void)
function once(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.once
once("readable", () => void)
function once(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.once
once(NodeEventTarget, string | symbol)
static function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>
參數
- emitter
-
NodeEventTarget
- event
-
string | symbol
傳回
Promise<any[]>
繼承自 EventEmitter.once
once(string | symbol, (args: any[]) => void)
function once(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.once
pause()
function pause(): this
傳回
this
繼承自 Readable.pause
pipe<T>(T, { end?: boolean })
function pipe<T>(destination: T, options?: { end?: boolean }): T
參數
- destination
-
T
- options
-
{ end?: boolean }
傳回
T
繼承自 internal.pipe
prependListener("close", () => void)
function prependListener(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.prependListener
prependListener("data", (chunk: any) => void)
function prependListener(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.prependListener
prependListener("end", () => void)
function prependListener(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.prependListener
prependListener("error", (err: Error) => void)
function prependListener(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.prependListener
prependListener("readable", () => void)
function prependListener(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.prependListener
prependListener(string | symbol, (args: any[]) => void)
function prependListener(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.prependListener
prependOnceListener("close", () => void)
function prependOnceListener(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.prependOnceListener
prependOnceListener("data", (chunk: any) => void)
function prependOnceListener(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.prependOnceListener
prependOnceListener("end", () => void)
function prependOnceListener(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.prependOnceListener
prependOnceListener("error", (err: Error) => void)
function prependOnceListener(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.prependOnceListener
prependOnceListener("readable", () => void)
function prependOnceListener(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.prependOnceListener
prependOnceListener(string | symbol, (args: any[]) => void)
function prependOnceListener(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.prependOnceListener
push(any, string)
function push(chunk: any, encoding?: string): boolean
參數
- chunk
-
any
- encoding
-
string
傳回
boolean
繼承自 Readable.push
rawListeners(string | symbol)
function rawListeners(event: string | symbol): Function[]
參數
- event
-
string | symbol
傳回
Function[]
繼承自 EventEmitter.rawListeners
read(number)
function read(size?: number): any
參數
- size
-
number
傳回
any
繼承自 Readable.read
removeAllListeners(string | symbol)
function removeAllListeners(event?: string | symbol): this
參數
- event
-
string | symbol
傳回
this
繼承自 EventEmitter.removeAllListeners
removeListener("close", () => void)
function removeListener(event: "close", listener: () => void): this
參數
- event
-
"close"
- listener
-
() => void
傳回
this
繼承自 Readable.removeListener
removeListener("data", (chunk: any) => void)
function removeListener(event: "data", listener: (chunk: any) => void): this
參數
- event
-
"data"
- listener
-
(chunk: any) => void
傳回
this
繼承自 Readable.removeListener
removeListener("end", () => void)
function removeListener(event: "end", listener: () => void): this
參數
- event
-
"end"
- listener
-
() => void
傳回
this
繼承自 Readable.removeListener
removeListener("error", (err: Error) => void)
function removeListener(event: "error", listener: (err: Error) => void): this
參數
- event
-
"error"
- listener
-
(err: Error) => void
傳回
this
繼承自 Readable.removeListener
removeListener("readable", () => void)
function removeListener(event: "readable", listener: () => void): this
參數
- event
-
"readable"
- listener
-
() => void
傳回
this
繼承自 Readable.removeListener
removeListener(string | symbol, (args: any[]) => void)
function removeListener(event: string | symbol, listener: (args: any[]) => void): this
參數
- event
-
string | symbol
- listener
-
(args: any[]) => void
傳回
this
繼承自 Readable.removeListener
resume()
function resume(): this
傳回
this
繼承自 Readable.resume
setDefaultEncoding(string)
function setDefaultEncoding(encoding: string): this
參數
- encoding
-
string
傳回
this
繼承自 Duplex.setDefaultEncoding
setEncoding(string)
function setEncoding(encoding: string): this
參數
- encoding
-
string
傳回
this
繼承自 Readable.setEncoding
setMaxListeners(number)
function setMaxListeners(n: number): this
參數
- n
-
number
傳回
this
繼承自 EventEmitter.setMaxListeners
uncork()
function uncork()
繼承自 Duplex.uncork
unpipe(WritableStream)
function unpipe(destination?: WritableStream): this
參數
- destination
-
WritableStream
傳回
this
繼承自 Readable.unpipe
unshift(any)
function unshift(chunk: any)
參數
- chunk
-
any
繼承自 Readable.unshift
wrap(ReadableStream)
function wrap(oldStream: ReadableStream): this
參數
- oldStream
-
ReadableStream
傳回
this
繼承自 Readable.wrap
write(any, (error: Error | null | undefined) => void)
function write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean
參數
- chunk
-
any
- cb
-
(error: Error | null | undefined) => void
傳回
boolean
繼承自 Duplex.write
write(any, string, (error: Error | null | undefined) => void)
function write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean
參數
- chunk
-
any
- encoding
-
string
- cb
-
(error: Error | null | undefined) => void
傳回
boolean
繼承自 Duplex.write