@codebolt/codeboltjs 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +47 -0
- package/{modules → dist}/agentlib/agent.js +4 -4
- package/{modules → dist}/agentlib/usermessage.js +3 -3
- package/dist/utils.d.ts +5 -0
- package/{utils.js → dist/utils.js} +4 -4
- package/package.json +17 -8
- package/.codebolt/chat.json +0 -1
- package/.codebolt/debug.json +0 -1
- package/.codebolt/projectState.json +0 -127
- package/.codebolt/tasks.json +0 -1
- package/.codeboltconfig.yaml +0 -0
- package/.github/workflows/publish-to-npm.yml +0 -20
- package/bkp/toolBox.bkp.ts +0 -1162
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.js +0 -15
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -59
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1412
- package/docs/classes/_internal_.Agent.html +0 -318
- package/docs/classes/_internal_.AsyncResource.html +0 -44
- package/docs/classes/_internal_.Blob.html +0 -33
- package/docs/classes/_internal_.ClientRequest.html +0 -506
- package/docs/classes/_internal_.Codebolt.html +0 -315
- package/docs/classes/_internal_.CustomEventEmitter-1.html +0 -248
- package/docs/classes/_internal_.CustomEventEmitter.html +0 -248
- package/docs/classes/_internal_.Duplex.html +0 -690
- package/docs/classes/_internal_.EventEmitter-1.html +0 -254
- package/docs/classes/_internal_.EventEmitter.EventEmitterAsyncResource.html +0 -268
- package/docs/classes/_internal_.IncomingMessage.html +0 -661
- package/docs/classes/_internal_.KeyObject.html +0 -76
- package/docs/classes/_internal_.OutgoingMessage.html +0 -491
- package/docs/classes/_internal_.Readable.html +0 -551
- package/docs/classes/_internal_.ReadableBase.html +0 -551
- package/docs/classes/_internal_.Server-1.html +0 -416
- package/docs/classes/_internal_.Server-2.html +0 -326
- package/docs/classes/_internal_.Server-3.html +0 -353
- package/docs/classes/_internal_.Server.html +0 -390
- package/docs/classes/_internal_.ServerResponse.html +0 -569
- package/docs/classes/_internal_.Socket.html +0 -791
- package/docs/classes/_internal_.Stream.html +0 -256
- package/docs/classes/_internal_.TLSSocket.html +0 -947
- package/docs/classes/_internal_.URL.html +0 -140
- package/docs/classes/_internal_.URLSearchParams.html +0 -68
- package/docs/classes/_internal_.WebSocket-1.html +0 -297
- package/docs/classes/_internal_.WebSocket.Server.html +0 -261
- package/docs/classes/_internal_.Writable.html +0 -394
- package/docs/classes/_internal_.WritableBase.html +0 -394
- package/docs/classes/_internal_.X509Certificate.html +0 -144
- package/docs/classes/_internal_.internal-1.html +0 -256
- package/docs/classes/_internal_.internal.PassThrough.html +0 -686
- package/docs/classes/_internal_.internal.Transform.html +0 -693
- package/docs/enums/_internal_.logType.html +0 -4
- package/docs/functions/_internal_.WebSocket.createWebSocketStream.html +0 -1
- package/docs/functions/_internal_._node_stream_consumers_.arrayBuffer.html +0 -1
- package/docs/functions/_internal_._node_stream_consumers_.blob.html +0 -1
- package/docs/functions/_internal_._node_stream_consumers_.buffer.html +0 -1
- package/docs/functions/_internal_._node_stream_consumers_.json.html +0 -1
- package/docs/functions/_internal_._node_stream_consumers_.text.html +0 -1
- package/docs/functions/_internal_._node_stream_promises_.finished.html +0 -1
- package/docs/functions/_internal_._node_stream_promises_.pipeline.html +0 -1
- package/docs/functions/_internal_.internal.addAbortSignal.html +0 -17
- package/docs/functions/_internal_.internal.finished-1.html +0 -20
- package/docs/functions/_internal_.internal.finished.__promisify__.html +0 -1
- package/docs/functions/_internal_.internal.getDefaultHighWaterMark.html +0 -4
- package/docs/functions/_internal_.internal.isErrored.html +0 -3
- package/docs/functions/_internal_.internal.isReadable.html +0 -3
- package/docs/functions/_internal_.internal.pipeline-1.html +0 -24
- package/docs/functions/_internal_.internal.pipeline.__promisify__.html +0 -1
- package/docs/functions/_internal_.internal.setDefaultHighWaterMark.html +0 -4
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -12
- package/docs/interfaces/_internal_.AddToAgentStateResponse.html +0 -3
- package/docs/interfaces/_internal_.AddTokenResponse.html +0 -3
- package/docs/interfaces/_internal_.AddVectorItemResponse.html +0 -3
- package/docs/interfaces/_internal_.AddressInfo.html +0 -4
- package/docs/interfaces/_internal_.AgentOptions.html +0 -35
- package/docs/interfaces/_internal_.ApplicationState.html +0 -4
- package/docs/interfaces/_internal_.ArrayBufferView.html +0 -7
- package/docs/interfaces/_internal_.ArrayLike.html +0 -2
- package/docs/interfaces/_internal_.ArrayOptions.html +0 -7
- package/docs/interfaces/_internal_.AsymmetricKeyDetails.html +0 -15
- package/docs/interfaces/_internal_.AsyncGenerator.html +0 -5
- package/docs/interfaces/_internal_.AsyncGeneratorFunction.html +0 -12
- package/docs/interfaces/_internal_.AsyncIterable.html +0 -2
- package/docs/interfaces/_internal_.AsyncIterableIterator.html +0 -5
- package/docs/interfaces/_internal_.AsyncIterator.html +0 -4
- package/docs/interfaces/_internal_.AsyncResourceOptions.html +0 -12
- package/docs/interfaces/_internal_.BlobOptions.html +0 -8
- package/docs/interfaces/_internal_.Buffer.html +0 -760
- package/docs/interfaces/_internal_.BufferConstructor.html +0 -165
- package/docs/interfaces/_internal_.Certificate.html +0 -13
- package/docs/interfaces/_internal_.ChatMessage.html +0 -3
- package/docs/interfaces/_internal_.Choice.html +0 -5
- package/docs/interfaces/_internal_.CipherNameAndProtocol.html +0 -7
- package/docs/interfaces/_internal_.ClientRequestArgs.html +0 -28
- package/docs/interfaces/_internal_.CommandError.html +0 -3
- package/docs/interfaces/_internal_.CommonConnectionOptions.html +0 -29
- package/docs/interfaces/_internal_.ConnectOpts.html +0 -5
- package/docs/interfaces/_internal_.CreateFileResponse.html +0 -6
- package/docs/interfaces/_internal_.CreateFolderResponse.html +0 -6
- package/docs/interfaces/_internal_.CryptoKey.html +0 -26
- package/docs/interfaces/_internal_.DebugAddLogResponse.html +0 -4
- package/docs/interfaces/_internal_.DeleteFileResponse.html +0 -6
- package/docs/interfaces/_internal_.DeleteFolderResponse.html +0 -6
- package/docs/interfaces/_internal_.DetailedPeerCertificate.html +0 -53
- package/docs/interfaces/_internal_.Dict.html +0 -1
- package/docs/interfaces/_internal_.Disposable.html +0 -2
- package/docs/interfaces/_internal_.DropArgument.html +0 -7
- package/docs/interfaces/_internal_.DuplexOptions.html +0 -22
- package/docs/interfaces/_internal_.EphemeralKeyInfo.html +0 -7
- package/docs/interfaces/_internal_.ErrnoException.html +0 -8
- package/docs/interfaces/_internal_.Error.html +0 -4
- package/docs/interfaces/_internal_.EventEmitter-2.html +0 -130
- package/docs/interfaces/_internal_.EventEmitter.Abortable.html +0 -3
- package/docs/interfaces/_internal_.EventEmitter.EventEmitterAsyncResourceOptions.html +0 -19
- package/docs/interfaces/_internal_.EventEmitter.EventEmitterReferencingAsyncResource.html +0 -32
- package/docs/interfaces/_internal_.EventEmitterOptions.html +0 -3
- package/docs/interfaces/_internal_.ExtractTextResponse.html +0 -3
- package/docs/interfaces/_internal_.GetAgentStateResponse.html +0 -3
- package/docs/interfaces/_internal_.GetContentResponse.html +0 -3
- package/docs/interfaces/_internal_.GetMarkdownResponse.html +0 -3
- package/docs/interfaces/_internal_.GetMatcherListTreeResponse.html +0 -3
- package/docs/interfaces/_internal_.GetProjectPathResponse.html +0 -5
- package/docs/interfaces/_internal_.GetTokenResponse.html +0 -3
- package/docs/interfaces/_internal_.GetVectorResponse.html +0 -3
- package/docs/interfaces/_internal_.GoToPageResponse.html +0 -3
- package/docs/interfaces/_internal_.HtmlReceived.html +0 -3
- package/docs/interfaces/_internal_.IncomingHttpHeaders.html +0 -64
- package/docs/interfaces/_internal_.InformationEvent.html +0 -8
- package/docs/interfaces/_internal_.IpcSocketConnectOpts.html +0 -6
- package/docs/interfaces/_internal_.Iterable.html +0 -2
- package/docs/interfaces/_internal_.IterableIterator.html +0 -5
- package/docs/interfaces/_internal_.Iterator.html +0 -4
- package/docs/interfaces/_internal_.IteratorReturnResult.html +0 -3
- package/docs/interfaces/_internal_.IteratorYieldResult.html +0 -3
- package/docs/interfaces/_internal_.JsonWebKey.html +0 -14
- package/docs/interfaces/_internal_.JwkKeyExportOptions.html +0 -2
- package/docs/interfaces/_internal_.KeyAlgorithm.html +0 -2
- package/docs/interfaces/_internal_.KeyExportOptions.html +0 -5
- package/docs/interfaces/_internal_.KeyObject-1.html +0 -5
- package/docs/interfaces/_internal_.LLMResponse.html +0 -4
- package/docs/interfaces/_internal_.ListenOptions.html +0 -13
- package/docs/interfaces/_internal_.LookupAddress.html +0 -6
- package/docs/interfaces/_internal_.LookupOptions.html +0 -27
- package/docs/interfaces/_internal_.MatchProblemResponse.html +0 -3
- package/docs/interfaces/_internal_.MemoryGetResponse.html +0 -5
- package/docs/interfaces/_internal_.MemorySetResponse.html +0 -5
- package/docs/interfaces/_internal_.Message.html +0 -8
- package/docs/interfaces/_internal_.MessageContent.html +0 -3
- package/docs/interfaces/_internal_.Object.html +0 -18
- package/docs/interfaces/_internal_.OnReadOpts.html +0 -6
- package/docs/interfaces/_internal_.OpenDebugBrowserResponse.html +0 -4
- package/docs/interfaces/_internal_.OutgoingHttpHeaders.html +0 -80
- package/docs/interfaces/_internal_.PeerCertificate.html +0 -50
- package/docs/interfaces/_internal_.PromiseLike.html +0 -6
- package/docs/interfaces/_internal_.PxfObject.html +0 -5
- package/docs/interfaces/_internal_.QueryVectorItemResponse.html +0 -3
- package/docs/interfaces/_internal_.QueuingStrategy.html +0 -3
- package/docs/interfaces/_internal_.QueuingStrategySize.html +0 -1
- package/docs/interfaces/_internal_.ReadFileResponse.html +0 -7
- package/docs/interfaces/_internal_.ReadOnlyDict.html +0 -1
- package/docs/interfaces/_internal_.ReadWriteStream.html +0 -144
- package/docs/interfaces/_internal_.ReadableByteStreamController.html +0 -6
- package/docs/interfaces/_internal_.ReadableByteStreamControllerCallback.html +0 -1
- package/docs/interfaces/_internal_.ReadableOptions.html +0 -11
- package/docs/interfaces/_internal_.ReadableStream-1.html +0 -141
- package/docs/interfaces/_internal_.ReadableStream.html +0 -10
- package/docs/interfaces/_internal_.ReadableStreamBYOBReader.html +0 -5
- package/docs/interfaces/_internal_.ReadableStreamDefaultController.html +0 -5
- package/docs/interfaces/_internal_.ReadableStreamDefaultReadDoneResult.html +0 -3
- package/docs/interfaces/_internal_.ReadableStreamDefaultReadValueResult.html +0 -3
- package/docs/interfaces/_internal_.ReadableStreamDefaultReader.html +0 -5
- package/docs/interfaces/_internal_.ReadableStreamErrorCallback.html +0 -1
- package/docs/interfaces/_internal_.ReadableStreamGenericReader.html +0 -3
- package/docs/interfaces/_internal_.ReadableStreamReadDoneResult.html +0 -3
- package/docs/interfaces/_internal_.ReadableStreamReadValueResult.html +0 -3
- package/docs/interfaces/_internal_.ReadableWritablePair.html +0 -9
- package/docs/interfaces/_internal_.SecureContext.html +0 -2
- package/docs/interfaces/_internal_.SecureContextOptions.html +0 -121
- package/docs/interfaces/_internal_.Selection.html +0 -6
- package/docs/interfaces/_internal_.ServerOptions.html +0 -64
- package/docs/interfaces/_internal_.ServerOpts.html +0 -25
- package/docs/interfaces/_internal_.SharedArrayBuffer.html +0 -7
- package/docs/interfaces/_internal_.SharedArrayBufferConstructor.html +0 -3
- package/docs/interfaces/_internal_.SocketConstructorOpts.html +0 -6
- package/docs/interfaces/_internal_.StaticEventEmitterOptions.html +0 -15
- package/docs/interfaces/_internal_.StreamOptions.html +0 -9
- package/docs/interfaces/_internal_.StreamPipeOptions.html +0 -37
- package/docs/interfaces/_internal_.TLSSocketOptions.html +0 -160
- package/docs/interfaces/_internal_.TcpSocketConnectOpts.html +0 -19
- package/docs/interfaces/_internal_.TerminalInterruptResponse.html +0 -3
- package/docs/interfaces/_internal_.TlsOptions.html +0 -197
- package/docs/interfaces/_internal_.UnderlyingByteSource.html +0 -6
- package/docs/interfaces/_internal_.UnderlyingSink.html +0 -6
- package/docs/interfaces/_internal_.UnderlyingSinkAbortCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSinkCloseCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSinkStartCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSinkWriteCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSource.html +0 -5
- package/docs/interfaces/_internal_.UnderlyingSourceCancelCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSourcePullCallback.html +0 -1
- package/docs/interfaces/_internal_.UnderlyingSourceStartCallback.html +0 -1
- package/docs/interfaces/_internal_.UpdateFileResponse.html +0 -6
- package/docs/interfaces/_internal_.UrlResponse.html +0 -3
- package/docs/interfaces/_internal_.Usage-1.html +0 -4
- package/docs/interfaces/_internal_.Usage.html +0 -4
- package/docs/interfaces/_internal_.UserMessage.html +0 -3
- package/docs/interfaces/_internal_.UserRequest.html +0 -7
- package/docs/interfaces/_internal_.WebSocket.AddressInfo.html +0 -4
- package/docs/interfaces/_internal_.WebSocket.ClientOptions.html +0 -138
- package/docs/interfaces/_internal_.WebSocket.CloseEvent.html +0 -6
- package/docs/interfaces/_internal_.WebSocket.ErrorEvent.html +0 -5
- package/docs/interfaces/_internal_.WebSocket.Event.html +0 -3
- package/docs/interfaces/_internal_.WebSocket.EventListenerOptions.html +0 -2
- package/docs/interfaces/_internal_.WebSocket.MessageEvent.html +0 -4
- package/docs/interfaces/_internal_.WebSocket.PerMessageDeflateOptions.html +0 -9
- package/docs/interfaces/_internal_.WebSocket.ServerOptions.html +0 -14
- package/docs/interfaces/_internal_.WebSocket.WebSocket.html +0 -172
- package/docs/interfaces/_internal_.WebSocket.WebSocketServer.html +0 -144
- package/docs/interfaces/_internal_.WebSocketAlias.html +0 -172
- package/docs/interfaces/_internal_.WritableOptions.html +0 -14
- package/docs/interfaces/_internal_.WritableStream-1.html +0 -8
- package/docs/interfaces/_internal_.WritableStream.html +0 -133
- package/docs/interfaces/_internal_.WritableStreamDefaultController.html +0 -6
- package/docs/interfaces/_internal_.WritableStreamDefaultWriter.html +0 -12
- package/docs/interfaces/_internal_.X509CheckOptions.html +0 -16
- package/docs/interfaces/_internal_.ZlibOptions.html +0 -21
- package/docs/interfaces/_internal_.getMatchDetail.html +0 -3
- package/docs/interfaces/_internal_.internal.FinishedOptions.html +0 -6
- package/docs/interfaces/_internal_.internal.Pipe.html +0 -5
- package/docs/interfaces/_internal_.internal.PipelineOptions.html +0 -3
- package/docs/interfaces/_internal_.internal.TransformOptions.html +0 -24
- package/docs/modules/_internal_.EventEmitter.html +0 -6
- package/docs/modules/_internal_.WebSocket.html +0 -21
- package/docs/modules/_internal_._node_stream_consumers_.html +0 -6
- package/docs/modules/_internal_._node_stream_promises_.html +0 -3
- package/docs/modules/_internal_.html +0 -228
- package/docs/modules/_internal_.internal.finished.html +0 -2
- package/docs/modules/_internal_.internal.html +0 -36
- package/docs/modules/_internal_.internal.pipeline.html +0 -2
- package/docs/modules.html +0 -3
- package/docs/types/_internal_.AnyRest.html +0 -1
- package/docs/types/_internal_.Args.html +0 -1
- package/docs/types/_internal_.ArrayBufferLike.html +0 -1
- package/docs/types/_internal_.ArrayBufferView-1.html +0 -1
- package/docs/types/_internal_.BinaryLike.html +0 -1
- package/docs/types/_internal_.BufferEncoding.html +0 -1
- package/docs/types/_internal_.BufferLike.html +0 -1
- package/docs/types/_internal_.ComposeFnParam.html +0 -1
- package/docs/types/_internal_.DefaultEventMap.html +0 -1
- package/docs/types/_internal_.EventMap.html +0 -1
- package/docs/types/_internal_.InstanceType.html +0 -2
- package/docs/types/_internal_.IteratorResult.html +0 -1
- package/docs/types/_internal_.Key.html +0 -1
- package/docs/types/_internal_.Key2.html +0 -1
- package/docs/types/_internal_.KeyFormat.html +0 -1
- package/docs/types/_internal_.KeyObjectType.html +0 -1
- package/docs/types/_internal_.KeyType-1.html +0 -1
- package/docs/types/_internal_.KeyType.html +0 -1
- package/docs/types/_internal_.KeyUsage.html +0 -1
- package/docs/types/_internal_.Listener.html +0 -1
- package/docs/types/_internal_.LookupFunction.html +0 -1
- package/docs/types/_internal_.OutgoingHttpHeader.html +0 -1
- package/docs/types/_internal_.Partial.html +0 -2
- package/docs/types/_internal_.Pick.html +0 -2
- package/docs/types/_internal_.PropertyKey.html +0 -1
- package/docs/types/_internal_.ReadableStreamController.html +0 -1
- package/docs/types/_internal_.ReadableStreamDefaultReadResult.html +0 -1
- package/docs/types/_internal_.ReadableStreamReadResult.html +0 -1
- package/docs/types/_internal_.Record.html +0 -2
- package/docs/types/_internal_.RequestListener.html +0 -1
- package/docs/types/_internal_.SecureVersion.html +0 -1
- package/docs/types/_internal_.ServerOptions-1.html +0 -1
- package/docs/types/_internal_.SocketConnectOpts.html +0 -1
- package/docs/types/_internal_.SocketReadyState.html +0 -1
- package/docs/types/_internal_.TypedArray.html +0 -1
- package/docs/types/_internal_.WebSocket.CertMeta.html +0 -2
- package/docs/types/_internal_.WebSocket.Data.html +0 -2
- package/docs/types/_internal_.WebSocket.RawData.html +0 -2
- package/docs/types/_internal_.WebSocket.VerifyClientCallbackAsync.html +0 -4
- package/docs/types/_internal_.WebSocket.VerifyClientCallbackSync.html +0 -4
- package/docs/types/_internal_.WithImplicitCoercion.html +0 -1
- package/docs/types/_internal_.internal.PipelineCallback.html +0 -1
- package/docs/types/_internal_.internal.PipelineDestination.html +0 -1
- package/docs/types/_internal_.internal.PipelineDestinationIterableFunction.html +0 -1
- package/docs/types/_internal_.internal.PipelineDestinationPromiseFunction.html +0 -1
- package/docs/types/_internal_.internal.PipelinePromise.html +0 -1
- package/docs/types/_internal_.internal.PipelineSource.html +0 -1
- package/docs/types/_internal_.internal.PipelineSourceFunction.html +0 -1
- package/docs/types/_internal_.internal.PipelineTransform.html +0 -1
- package/docs/types/_internal_.internal.PipelineTransformSource.html +0 -1
- package/docs/types/_internal_.internal.TransformCallback.html +0 -1
- package/docs/variables/_internal_.Buffer-1.html +0 -1
- package/docs/variables/_internal_.Error-1.html +0 -1
- package/docs/variables/_internal_.Object-1.html +0 -2
- package/docs/variables/_internal_.ReadableByteStreamController-1.html +0 -1
- package/docs/variables/_internal_.ReadableStream-2.html +0 -1
- package/docs/variables/_internal_.ReadableStreamBYOBReader-1.html +0 -1
- package/docs/variables/_internal_.ReadableStreamDefaultController-1.html +0 -1
- package/docs/variables/_internal_.ReadableStreamDefaultReader-1.html +0 -1
- package/docs/variables/_internal_.SharedArrayBuffer-1.html +0 -1
- package/docs/variables/_internal_.WebSocket.WebSocket-1.html +0 -1
- package/docs/variables/_internal_.WebSocket.WebSocketServer-1.html +0 -1
- package/docs/variables/_internal_.WebSocketAlias-1.html +0 -1
- package/docs/variables/_internal_.WritableStream-2.html +0 -1
- package/docs/variables/_internal_.WritableStreamDefaultController-1.html +0 -1
- package/docs/variables/_internal_.WritableStreamDefaultWriter-1.html +0 -1
- package/docs/variables/_internal_.internal.consumers.html +0 -1
- package/docs/variables/_internal_.internal.promises.html +0 -1
- package/docs/variables/default.html +0 -1
- package/script/gen.js +0 -27
- package/src/index.ts +0 -108
- package/src/modules/agent.ts +0 -120
- package/src/modules/agentlib/agent.ts +0 -417
- package/src/modules/agentlib/systemprompt.ts +0 -55
- package/src/modules/agentlib/taskInstruction.ts +0 -105
- package/src/modules/agentlib/usermessage.ts +0 -188
- package/src/modules/browser.ts +0 -352
- package/src/modules/chat.ts +0 -229
- package/src/modules/codeparsers.ts +0 -28
- package/src/modules/codeutils.ts +0 -182
- package/src/modules/crawler.ts +0 -121
- package/src/modules/dbmemory.ts +0 -52
- package/src/modules/debug.ts +0 -68
- package/src/modules/docutils.ts +0 -18
- package/src/modules/fs.ts +0 -263
- package/src/modules/git.ts +0 -237
- package/src/modules/history.ts +0 -82
- package/src/modules/knowledge.ts +0 -5
- package/src/modules/llm.ts +0 -36
- package/src/modules/outputparsers.ts +0 -30
- package/src/modules/project.ts +0 -68
- package/src/modules/rag.ts +0 -27
- package/src/modules/search.ts +0 -32
- package/src/modules/state.ts +0 -115
- package/src/modules/task.ts +0 -73
- package/src/modules/terminal.ts +0 -113
- package/src/modules/tokenizer.ts +0 -56
- package/src/modules/toolBox.ts +0 -1384
- package/src/modules/tools.ts +0 -254
- package/src/modules/vectordb.ts +0 -102
- package/src/modules/websocket.ts +0 -97
- package/src/utils/editFile.ts +0 -30
- package/src/utils.ts +0 -5
- package/tests/chat.test.js +0 -0
- package/tests/fs.test.js +0 -89
- package/tests/index.test.js +0 -4
- package/tsconfig.json +0 -122
- package/utils.d.ts +0 -5
- package/webpack.config.js +0 -25
- /package/{modules → dist}/agentlib/agent.d.ts +0 -0
- /package/{modules → dist}/agentlib/systemprompt.d.ts +0 -0
- /package/{modules → dist}/agentlib/systemprompt.js +0 -0
- /package/{modules → dist}/agentlib/taskInstruction.d.ts +0 -0
- /package/{modules → dist}/agentlib/taskInstruction.js +0 -0
- /package/{modules → dist}/agentlib/usermessage.d.ts +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{modules → dist/modules}/agent.d.ts +0 -0
- /package/{modules → dist/modules}/agent.js +0 -0
- /package/{modules → dist/modules}/browser.d.ts +0 -0
- /package/{modules → dist/modules}/browser.js +0 -0
- /package/{modules → dist/modules}/chat.d.ts +0 -0
- /package/{modules → dist/modules}/chat.js +0 -0
- /package/{modules → dist/modules}/codeparsers.d.ts +0 -0
- /package/{modules → dist/modules}/codeparsers.js +0 -0
- /package/{modules → dist/modules}/codeutils.d.ts +0 -0
- /package/{modules → dist/modules}/codeutils.js +0 -0
- /package/{modules → dist/modules}/crawler.d.ts +0 -0
- /package/{modules → dist/modules}/crawler.js +0 -0
- /package/{modules → dist/modules}/dbmemory.d.ts +0 -0
- /package/{modules → dist/modules}/dbmemory.js +0 -0
- /package/{modules → dist/modules}/debug.d.ts +0 -0
- /package/{modules → dist/modules}/debug.js +0 -0
- /package/{modules → dist/modules}/docutils.d.ts +0 -0
- /package/{modules → dist/modules}/docutils.js +0 -0
- /package/{modules → dist/modules}/fs.d.ts +0 -0
- /package/{modules → dist/modules}/fs.js +0 -0
- /package/{modules → dist/modules}/git.d.ts +0 -0
- /package/{modules → dist/modules}/git.js +0 -0
- /package/{modules → dist/modules}/history.d.ts +0 -0
- /package/{modules → dist/modules}/history.js +0 -0
- /package/{modules → dist/modules}/knowledge.d.ts +0 -0
- /package/{modules → dist/modules}/knowledge.js +0 -0
- /package/{modules → dist/modules}/llm.d.ts +0 -0
- /package/{modules → dist/modules}/llm.js +0 -0
- /package/{modules → dist/modules}/outputparsers.d.ts +0 -0
- /package/{modules → dist/modules}/outputparsers.js +0 -0
- /package/{modules → dist/modules}/project.d.ts +0 -0
- /package/{modules → dist/modules}/project.js +0 -0
- /package/{modules → dist/modules}/rag.d.ts +0 -0
- /package/{modules → dist/modules}/rag.js +0 -0
- /package/{modules → dist/modules}/search.d.ts +0 -0
- /package/{modules → dist/modules}/search.js +0 -0
- /package/{modules → dist/modules}/state.d.ts +0 -0
- /package/{modules → dist/modules}/state.js +0 -0
- /package/{modules → dist/modules}/task.d.ts +0 -0
- /package/{modules → dist/modules}/task.js +0 -0
- /package/{modules → dist/modules}/terminal.d.ts +0 -0
- /package/{modules → dist/modules}/terminal.js +0 -0
- /package/{modules → dist/modules}/tokenizer.d.ts +0 -0
- /package/{modules → dist/modules}/tokenizer.js +0 -0
- /package/{modules → dist/modules}/toolBox.d.ts +0 -0
- /package/{modules → dist/modules}/toolBox.js +0 -0
- /package/{modules → dist/modules}/tools.d.ts +0 -0
- /package/{modules → dist/modules}/tools.js +0 -0
- /package/{modules → dist/modules}/vectordb.d.ts +0 -0
- /package/{modules → dist/modules}/vectordb.js +0 -0
- /package/{modules → dist/modules}/websocket.d.ts +0 -0
- /package/{modules → dist/modules}/websocket.js +0 -0
- /package/{utils → dist/utils}/editFile.d.ts +0 -0
- /package/{utils → dist/utils}/editFile.js +0 -0
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Readable | @codebolt/codeboltjs</title><meta name="description" content="Documentation for @codebolt/codeboltjs"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@codebolt/codeboltjs</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@codebolt/codeboltjs</a></li><li><a href="../modules/_internal_.html"><internal></a></li><li><a href="_internal_.Readable.html">Readable</a></li></ul><h1>Class Readable</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
2
|
-
</div></section><section class="tsd-panel tsd-hierarchy"><h4>Hierarchy (<a class="link" href="../hierarchy.html#<internal>.Readable">view full</a>)</h4><ul class="tsd-hierarchy"><li><a href="_internal_.ReadableBase.html" class="tsd-signature-type tsd-kind-class">ReadableBase</a><ul class="tsd-hierarchy"><li><span class="target">Readable</span><ul class="tsd-hierarchy"><li><a href="_internal_.IncomingMessage.html" class="tsd-signature-type tsd-kind-class">IncomingMessage</a></li></ul></li></ul></li></ul></section><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/stream.d.ts:969</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="_internal_.Readable.html#constructor" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
|
3
|
-
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="_internal_.Readable.html#closed" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>closed</span></a>
|
|
4
|
-
<a href="_internal_.Readable.html#destroyed" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>destroyed</span></a>
|
|
5
|
-
<a href="_internal_.Readable.html#errored" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>errored</span></a>
|
|
6
|
-
<a href="_internal_.Readable.html#readable" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable</span></a>
|
|
7
|
-
<a href="_internal_.Readable.html#readableAborted" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Aborted</span></a>
|
|
8
|
-
<a href="_internal_.Readable.html#readableDidRead" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Did<wbr/>Read</span></a>
|
|
9
|
-
<a href="_internal_.Readable.html#readableEncoding" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Encoding</span></a>
|
|
10
|
-
<a href="_internal_.Readable.html#readableEnded" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Ended</span></a>
|
|
11
|
-
<a href="_internal_.Readable.html#readableFlowing" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Flowing</span></a>
|
|
12
|
-
<a href="_internal_.Readable.html#readableHighWaterMark" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>High<wbr/>Water<wbr/>Mark</span></a>
|
|
13
|
-
<a href="_internal_.Readable.html#readableLength" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Length</span></a>
|
|
14
|
-
<a href="_internal_.Readable.html#readableObjectMode" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Object<wbr/>Mode</span></a>
|
|
15
|
-
<a href="_internal_.Readable.html#captureRejectionSymbol" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejection<wbr/>Symbol</span></a>
|
|
16
|
-
<a href="_internal_.Readable.html#captureRejections" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejections</span></a>
|
|
17
|
-
<a href="_internal_.Readable.html#defaultMaxListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>default<wbr/>Max<wbr/>Listeners</span></a>
|
|
18
|
-
<a href="_internal_.Readable.html#errorMonitor" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>error<wbr/>Monitor</span></a>
|
|
19
|
-
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="_internal_.Readable.html#_asyncDispose_" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[async<wbr/>Dispose]</span></a>
|
|
20
|
-
<a href="_internal_.Readable.html#_asyncIterator_" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[async<wbr/>Iterator]</span></a>
|
|
21
|
-
<a href="_internal_.Readable.html#_captureRejectionSymbol_" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[capture<wbr/>Rejection<wbr/>Symbol]?</span></a>
|
|
22
|
-
<a href="_internal_.Readable.html#_construct" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_construct?</span></a>
|
|
23
|
-
<a href="_internal_.Readable.html#_destroy" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_destroy</span></a>
|
|
24
|
-
<a href="_internal_.Readable.html#_read" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_read</span></a>
|
|
25
|
-
<a href="_internal_.Readable.html#addListener" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Listener</span></a>
|
|
26
|
-
<a href="_internal_.Readable.html#asIndexedPairs" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>as<wbr/>Indexed<wbr/>Pairs</span></a>
|
|
27
|
-
<a href="_internal_.Readable.html#compose" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>compose</span></a>
|
|
28
|
-
<a href="_internal_.Readable.html#destroy" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>destroy</span></a>
|
|
29
|
-
<a href="_internal_.Readable.html#drop" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop</span></a>
|
|
30
|
-
<a href="_internal_.Readable.html#emit" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a>
|
|
31
|
-
<a href="_internal_.Readable.html#eventNames" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>event<wbr/>Names</span></a>
|
|
32
|
-
<a href="_internal_.Readable.html#every" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>every</span></a>
|
|
33
|
-
<a href="_internal_.Readable.html#filter" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>filter</span></a>
|
|
34
|
-
<a href="_internal_.Readable.html#find" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find</span></a>
|
|
35
|
-
<a href="_internal_.Readable.html#flatMap" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>flat<wbr/>Map</span></a>
|
|
36
|
-
<a href="_internal_.Readable.html#forEach" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>for<wbr/>Each</span></a>
|
|
37
|
-
<a href="_internal_.Readable.html#getMaxListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a>
|
|
38
|
-
<a href="_internal_.Readable.html#isPaused" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Paused</span></a>
|
|
39
|
-
<a href="_internal_.Readable.html#iterator" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>iterator</span></a>
|
|
40
|
-
<a href="_internal_.Readable.html#listenerCount" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a>
|
|
41
|
-
<a href="_internal_.Readable.html#listeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listeners</span></a>
|
|
42
|
-
<a href="_internal_.Readable.html#map" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>map</span></a>
|
|
43
|
-
<a href="_internal_.Readable.html#off" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a>
|
|
44
|
-
<a href="_internal_.Readable.html#on" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a>
|
|
45
|
-
<a href="_internal_.Readable.html#once" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a>
|
|
46
|
-
<a href="_internal_.Readable.html#pause" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>pause</span></a>
|
|
47
|
-
<a href="_internal_.Readable.html#pipe" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>pipe</span></a>
|
|
48
|
-
<a href="_internal_.Readable.html#prependListener" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Listener</span></a>
|
|
49
|
-
<a href="_internal_.Readable.html#prependOnceListener" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Once<wbr/>Listener</span></a>
|
|
50
|
-
<a href="_internal_.Readable.html#push" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>push</span></a>
|
|
51
|
-
<a href="_internal_.Readable.html#rawListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>raw<wbr/>Listeners</span></a>
|
|
52
|
-
<a href="_internal_.Readable.html#read" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read</span></a>
|
|
53
|
-
<a href="_internal_.Readable.html#reduce" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>reduce</span></a>
|
|
54
|
-
<a href="_internal_.Readable.html#removeAllListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>All<wbr/>Listeners</span></a>
|
|
55
|
-
<a href="_internal_.Readable.html#removeListener" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Listener</span></a>
|
|
56
|
-
<a href="_internal_.Readable.html#resume" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>resume</span></a>
|
|
57
|
-
<a href="_internal_.Readable.html#setEncoding" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Encoding</span></a>
|
|
58
|
-
<a href="_internal_.Readable.html#setMaxListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a>
|
|
59
|
-
<a href="_internal_.Readable.html#some" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>some</span></a>
|
|
60
|
-
<a href="_internal_.Readable.html#take" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>take</span></a>
|
|
61
|
-
<a href="_internal_.Readable.html#toArray" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Array</span></a>
|
|
62
|
-
<a href="_internal_.Readable.html#unpipe" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unpipe</span></a>
|
|
63
|
-
<a href="_internal_.Readable.html#unshift" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unshift</span></a>
|
|
64
|
-
<a href="_internal_.Readable.html#wrap" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wrap</span></a>
|
|
65
|
-
<a href="_internal_.Readable.html#addAbortListener" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Abort<wbr/>Listener</span></a>
|
|
66
|
-
<a href="_internal_.Readable.html#from" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>from</span></a>
|
|
67
|
-
<a href="_internal_.Readable.html#fromWeb" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>from<wbr/>Web</span></a>
|
|
68
|
-
<a href="_internal_.Readable.html#getEventListeners" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Event<wbr/>Listeners</span></a>
|
|
69
|
-
<a href="_internal_.Readable.html#getMaxListeners-2" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a>
|
|
70
|
-
<a href="_internal_.Readable.html#isDisturbed" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Disturbed</span></a>
|
|
71
|
-
<a href="_internal_.Readable.html#listenerCount-2" class="tsd-index-link deprecated tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a>
|
|
72
|
-
<a href="_internal_.Readable.html#on-9" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a>
|
|
73
|
-
<a href="_internal_.Readable.html#once-9" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a>
|
|
74
|
-
<a href="_internal_.Readable.html#setMaxListeners-2" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a>
|
|
75
|
-
<a href="_internal_.Readable.html#toWeb" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Web</span></a>
|
|
76
|
-
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_Readable" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Readable</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">opts</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#constructor.new_Readable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">opts</span>: <a href="../interfaces/_internal_.ReadableOptions.html" class="tsd-signature-type tsd-kind-interface">ReadableOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#constructor">constructor</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:132</li></ul></aside></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="closed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>closed</span><a href="#closed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">closed</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Is <code>true</code> after <code>'close'</code> has been emitted.</p>
|
|
77
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v18.0.0</p>
|
|
78
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#closed">closed</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:126</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="destroyed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>destroyed</span><a href="#destroyed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">destroyed</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Is <code>true</code> after <code>readable.destroy()</code> has been called.</p>
|
|
79
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v8.0.0</p>
|
|
80
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#destroyed">destroyed</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:121</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="errored" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>errored</span><a href="#errored" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">errored</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></div><div class="tsd-comment tsd-typography"><p>Returns error if the stream has been destroyed with an error.</p>
|
|
81
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v18.0.0</p>
|
|
82
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#errored">errored</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:131</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>readable</span><a href="#readable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Is <code>true</code> if it is safe to call <a href="_internal_.ReadableBase.html#read" class="tsd-kind-method">read</a>, which means
|
|
83
|
-
the stream has not been destroyed or emitted <code>'error'</code> or <code>'end'</code>.</p>
|
|
84
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v11.4.0</p>
|
|
85
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readable">readable</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:77</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableAborted" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <code class="tsd-tag ts-flagExperimental">Experimental</code> <span>readable<wbr/>Aborted</span><a href="#readableAborted" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Aborted</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Returns whether the stream was destroyed or errored before emitting <code>'end'</code>.</p>
|
|
86
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v16.8.0</p>
|
|
87
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableAborted">readableAborted</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:71</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableDidRead" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <code class="tsd-tag ts-flagExperimental">Experimental</code> <span>readable<wbr/>Did<wbr/>Read</span><a href="#readableDidRead" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Did<wbr/>Read</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Returns whether <code>'data'</code> has been emitted.</p>
|
|
88
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v16.7.0, v14.18.0</p>
|
|
89
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableDidRead">readableDidRead</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:83</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableEncoding" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>Encoding</span><a href="#readableEncoding" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Encoding</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/_internal_.BufferEncoding.html" class="tsd-signature-type tsd-kind-type-alias">BufferEncoding</a></div><div class="tsd-comment tsd-typography"><p>Getter for the property <code>encoding</code> of a given <code>Readable</code> stream. The <code>encoding</code> property can be set using the <a href="_internal_.ReadableBase.html#setEncoding" class="tsd-kind-method">setEncoding</a> method.</p>
|
|
90
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v12.7.0</p>
|
|
91
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableEncoding">readableEncoding</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:88</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableEnded" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>Ended</span><a href="#readableEnded" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Ended</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Becomes <code>true</code> when <a href="https://nodejs.org/docs/latest-v20.x/api/stream.html#event-end"><code>'end'</code></a> event is emitted.</p>
|
|
92
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v12.9.0</p>
|
|
93
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableEnded">readableEnded</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:93</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableFlowing" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>Flowing</span><a href="#readableFlowing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Flowing</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>This property reflects the current state of a <code>Readable</code> stream as described
|
|
94
|
-
in the <a href="https://nodejs.org/docs/latest-v20.x/api/stream.html#three-states">Three states</a> section.</p>
|
|
95
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v9.4.0</p>
|
|
96
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableFlowing">readableFlowing</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:99</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableHighWaterMark" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>High<wbr/>Water<wbr/>Mark</span><a href="#readableHighWaterMark" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>High<wbr/>Water<wbr/>Mark</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>Returns the value of <code>highWaterMark</code> passed when creating this <code>Readable</code>.</p>
|
|
97
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v9.3.0</p>
|
|
98
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableHighWaterMark">readableHighWaterMark</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:104</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableLength" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>Length</span><a href="#readableLength" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Length</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>This property contains the number of bytes (or objects) in the queue
|
|
99
|
-
ready to be read. The value provides introspection data regarding
|
|
100
|
-
the status of the <code>highWaterMark</code>.</p>
|
|
101
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v9.4.0</p>
|
|
102
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableLength">readableLength</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:111</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="readableObjectMode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>readable<wbr/>Object<wbr/>Mode</span><a href="#readableObjectMode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readable<wbr/>Object<wbr/>Mode</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Getter for the property <code>objectMode</code> of a given <code>Readable</code> stream.</p>
|
|
103
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v12.3.0</p>
|
|
104
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#readableObjectMode">readableObjectMode</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:116</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="captureRejectionSymbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <code class="tsd-tag ts-flagReadonly">Readonly</code> <span>capture<wbr/>Rejection<wbr/>Symbol</span><a href="#captureRejectionSymbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">capture<wbr/>Rejection<wbr/>Symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof </span><a href="_internal_.EventEmitter-1.html#captureRejectionSymbol" class="tsd-signature-type tsd-kind-property">captureRejectionSymbol</a></div><div class="tsd-comment tsd-typography"><p>Value: <code>Symbol.for('nodejs.rejection')</code></p>
|
|
105
|
-
<p>See how to write a custom <code>rejection handler</code>.</p>
|
|
106
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v13.4.0, v12.16.0</p>
|
|
107
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#captureRejectionSymbol">captureRejectionSymbol</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:430</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="captureRejections" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>capture<wbr/>Rejections</span><a href="#captureRejections" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">capture<wbr/>Rejections</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Value: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean</a></p>
|
|
108
|
-
<p>Change the default <code>captureRejections</code> option on all new <code>EventEmitter</code> objects.</p>
|
|
109
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v13.4.0, v12.16.0</p>
|
|
110
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#captureRejections">captureRejections</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:437</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="defaultMaxListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>default<wbr/>Max<wbr/>Listeners</span><a href="#defaultMaxListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">default<wbr/>Max<wbr/>Listeners</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>By default, a maximum of <code>10</code> listeners can be registered for any single
|
|
111
|
-
event. This limit can be changed for individual <code>EventEmitter</code> instances
|
|
112
|
-
using the <code>emitter.setMaxListeners(n)</code> method. To change the default
|
|
113
|
-
for <em>all</em><code>EventEmitter</code> instances, the <code>events.defaultMaxListeners</code> property
|
|
114
|
-
can be used. If this value is not a positive number, a <code>RangeError</code> is thrown.</p>
|
|
115
|
-
<p>Take caution when setting the <code>events.defaultMaxListeners</code> because the
|
|
116
|
-
change affects <em>all</em> <code>EventEmitter</code> instances, including those created before
|
|
117
|
-
the change is made. However, calling <code>emitter.setMaxListeners(n)</code> still has
|
|
118
|
-
precedence over <code>events.defaultMaxListeners</code>.</p>
|
|
119
|
-
<p>This is not a hard limit. The <code>EventEmitter</code> instance will allow
|
|
120
|
-
more listeners to be added but will output a trace warning to stderr indicating
|
|
121
|
-
that a "possible EventEmitter memory leak" has been detected. For any single
|
|
122
|
-
<code>EventEmitter</code>, the <code>emitter.getMaxListeners()</code> and <code>emitter.setMaxListeners()</code> methods can be used to
|
|
123
|
-
temporarily avoid this warning:</p>
|
|
124
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">emitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">setMaxListeners</span><span class="hl-1">(</span><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">getMaxListeners</span><span class="hl-1">() + </span><span class="hl-9">1</span><span class="hl-1">);</span><br/><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">// do stuff</span><br/><span class="hl-1"> </span><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">setMaxListeners</span><span class="hl-1">(</span><span class="hl-7">Math</span><span class="hl-1">.</span><span class="hl-0">max</span><span class="hl-1">(</span><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">getMaxListeners</span><span class="hl-1">() - </span><span class="hl-9">1</span><span class="hl-1">, </span><span class="hl-9">0</span><span class="hl-1">));</span><br/><span class="hl-1">});</span>
|
|
125
|
-
</code><button>Copy</button></pre>
|
|
126
|
-
<p>The <code>--trace-warnings</code> command-line flag can be used to display the
|
|
127
|
-
stack trace for such warnings.</p>
|
|
128
|
-
<p>The emitted warning can be inspected with <code>process.on('warning')</code> and will
|
|
129
|
-
have the additional <code>emitter</code>, <code>type</code>, and <code>count</code> properties, referring to
|
|
130
|
-
the event emitter instance, the event's name and the number of attached
|
|
131
|
-
listeners, respectively.
|
|
132
|
-
Its <code>name</code> property is set to <code>'MaxListenersExceededWarning'</code>.</p>
|
|
133
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.11.2</p>
|
|
134
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#defaultMaxListeners">defaultMaxListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:476</li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="errorMonitor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <code class="tsd-tag ts-flagReadonly">Readonly</code> <span>error<wbr/>Monitor</span><a href="#errorMonitor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">error<wbr/>Monitor</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof </span><a href="_internal_.EventEmitter-1.html#errorMonitor" class="tsd-signature-type tsd-kind-property">errorMonitor</a></div><div class="tsd-comment tsd-typography"><p>This symbol shall be used to install a listener for only monitoring <code>'error'</code> events. Listeners installed using this symbol are called before the regular <code>'error'</code> listeners are called.</p>
|
|
135
|
-
<p>Installing a listener using this symbol does not change the behavior once an <code>'error'</code> event is emitted. Therefore, the process will still crash if no
|
|
136
|
-
regular <code>'error'</code> listener is installed.</p>
|
|
137
|
-
</div><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v13.6.0, v12.17.0</p>
|
|
138
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#errorMonitor">errorMonitor</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:423</li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods</h2><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_asyncDispose_" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[async<wbr/>Dispose]</span><a href="#_asyncDispose_" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_asyncDispose_._asyncDispose_-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">[async<wbr/>Dispose]</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#_asyncDispose_._asyncDispose_-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Calls <code>readable.destroy()</code> with an <code>AbortError</code> and returns a promise that fulfills when the stream is finished.</p>
|
|
139
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v20.4.0</p>
|
|
140
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_asyncDispose_">[asyncDispose]</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:659</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_asyncIterator_" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[async<wbr/>Iterator]</span><a href="#_asyncIterator_" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_asyncIterator_._asyncIterator_-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">[async<wbr/>Iterator]</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#_asyncIterator_._asyncIterator_-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_asyncIterator_">[asyncIterator]</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:654</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_captureRejectionSymbol_" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>[capture<wbr/>Rejection<wbr/>Symbol]</span><a href="#_captureRejectionSymbol_" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_captureRejectionSymbol_._captureRejectionSymbol_-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">[capture<wbr/>Rejection<wbr/>Symbol]</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#_captureRejectionSymbol_._captureRejectionSymbol_-1.K">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span>, <span class="tsd-kind-parameter">event</span>, <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_captureRejectionSymbol_._captureRejectionSymbol_-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="_captureRejectionSymbol_._captureRejectionSymbol_-1.K" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">error</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <a href="../types/_internal_.AnyRest.html" class="tsd-signature-type tsd-kind-type-alias">AnyRest</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_captureRejectionSymbol_">[captureRejectionSymbol]</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:135</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_construct" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>_construct</span><a href="#_construct" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_construct._construct-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_construct</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">callback</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_construct._construct-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">callback</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">error</span>: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_construct">_construct</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:133</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_destroy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_destroy</span><a href="#_destroy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_destroy._destroy-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_destroy</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span>, <span class="tsd-kind-parameter">callback</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_destroy._destroy-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">error</span>: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li><li><span><span class="tsd-kind-parameter">callback</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">error</span>: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_destroy">_destroy</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:574</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="_read" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_read</span><a href="#_read" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="_read._read-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_read</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">size</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_read._read-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">size</span>: <span class="tsd-signature-type">number</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#_read">_read</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:134</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="addListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>add<wbr/>Listener</span><a href="#addListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Event emitter
|
|
141
|
-
The defined events on documents including:</p>
|
|
142
|
-
<ol>
|
|
143
|
-
<li>close</li>
|
|
144
|
-
<li>data</li>
|
|
145
|
-
<li>end</li>
|
|
146
|
-
<li>error</li>
|
|
147
|
-
<li>pause</li>
|
|
148
|
-
<li>readable</li>
|
|
149
|
-
<li>resume</li>
|
|
150
|
-
</ol>
|
|
151
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:598</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:599</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:600</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:601</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:602</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:603</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:604</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="addListener.addListener-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addListener.addListener-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addListener">addListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:605</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="asIndexedPairs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>as<wbr/>Indexed<wbr/>Pairs</span><a href="#asIndexedPairs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="asIndexedPairs.asIndexedPairs-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">as<wbr/>Indexed<wbr/>Pairs</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#asIndexedPairs.asIndexedPairs-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method returns a new stream with chunks of the underlying stream paired with a counter
|
|
152
|
-
in the form <code>[index, chunk]</code>. The first index value is <code>0</code> and it increases by 1 for each chunk produced.</p>
|
|
153
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream of indexed pairs.</p>
|
|
154
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
155
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#asIndexedPairs">asIndexedPairs</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:549</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="compose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>compose</span><a href="#compose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="compose.compose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">compose</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#compose.compose-1.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">stream</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#compose.compose-1.T">T</a><a href="#compose.compose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="compose.compose-1.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/_internal_.ReadableStream-1.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">stream</span>: <a href="../types/_internal_.ComposeFnParam.html" class="tsd-signature-type tsd-kind-type-alias">ComposeFnParam</a><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#compose.compose-1.T">T</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.Iterable.html" class="tsd-signature-type tsd-kind-interface">Iterable</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#compose.compose-1.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.AsyncIterable.html" class="tsd-signature-type tsd-kind-interface">AsyncIterable</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#compose.compose-1.T">T</a><span class="tsd-signature-symbol">></span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">signal</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AbortSignal</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">signal</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AbortSignal</span></h5></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#compose.compose-1.T">T</a></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#compose">compose</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:36</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="destroy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>destroy</span><a href="#destroy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="destroy.destroy-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">destroy</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">error</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#destroy.destroy-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Destroy the stream. Optionally emit an <code>'error'</code> event, and emit a <code>'close'</code> event (unless <code>emitClose</code> is set to <code>false</code>). After this call, the readable
|
|
156
|
-
stream will release any internal resources and subsequent calls to <code>push()</code> will be ignored.</p>
|
|
157
|
-
<p>Once <code>destroy()</code> has been called any further calls will be a no-op and no
|
|
158
|
-
further errors except from <code>_destroy()</code> may be emitted as <code>'error'</code>.</p>
|
|
159
|
-
<p>Implementors should not override this method, but instead implement <code>readable._destroy()</code>.</p>
|
|
160
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">error</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span><div class="tsd-comment tsd-typography"><p>Error which will be passed as payload in <code>'error'</code> event</p>
|
|
161
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v8.0.0</p>
|
|
162
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#destroy">destroy</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:586</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="drop" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>drop</span><a href="#drop" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="drop.drop-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">limit</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#drop.drop-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method returns a new stream with the first <em>limit</em> chunks dropped from the start.</p>
|
|
163
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">limit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>the number of chunks to drop from the readable.</p>
|
|
164
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream with <em>limit</em> chunks dropped from the start.</p>
|
|
165
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
166
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#drop">drop</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:535</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="emit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>emit</span><a href="#emit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Synchronously calls each of the listeners registered for the event named <code>eventName</code>, in the order they were registered, passing the supplied arguments
|
|
167
|
-
to each.</p>
|
|
168
|
-
<p>Returns <code>true</code> if the event had listeners, <code>false</code> otherwise.</p>
|
|
169
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEmitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-5">// First listener</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">firstListener</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Helloooo! first listener'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-5">// Second listener</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">secondListener</span><span class="hl-1">(</span><span class="hl-7">arg1</span><span class="hl-1">, </span><span class="hl-7">arg2</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`event with parameters </span><span class="hl-3">${</span><span class="hl-7">arg1</span><span class="hl-3">}</span><span class="hl-2">, </span><span class="hl-3">${</span><span class="hl-7">arg2</span><span class="hl-3">}</span><span class="hl-2"> in second listener`</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-5">// Third listener</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">thirdListener</span><span class="hl-1">(...</span><span class="hl-7">args</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">parameters</span><span class="hl-1"> = </span><span class="hl-7">args</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-2">', '</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`event with parameters </span><span class="hl-3">${</span><span class="hl-7">parameters</span><span class="hl-3">}</span><span class="hl-2"> in third listener`</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">listeners</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">));</span><br/><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-9">1</span><span class="hl-1">, </span><span class="hl-9">2</span><span class="hl-1">, </span><span class="hl-9">3</span><span class="hl-1">, </span><span class="hl-9">4</span><span class="hl-1">, </span><span class="hl-9">5</span><span class="hl-1">);</span><br/><br/><span class="hl-5">// Prints:</span><br/><span class="hl-5">// [</span><br/><span class="hl-5">// [Function: firstListener],</span><br/><span class="hl-5">// [Function: secondListener],</span><br/><span class="hl-5">// [Function: thirdListener]</span><br/><span class="hl-5">// ]</span><br/><span class="hl-5">// Helloooo! first listener</span><br/><span class="hl-5">// event with parameters 1, 2 in second listener</span><br/><span class="hl-5">// event with parameters 1, 2, 3, 4, 5 in third listener</span>
|
|
170
|
-
</code><button>Copy</button></pre>
|
|
171
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.1.26</p>
|
|
172
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:606</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:607</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:608</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:609</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:610</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:611</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:612</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#emit">emit</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:613</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="eventNames" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>event<wbr/>Names</span><a href="#eventNames" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="eventNames.eventNames-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">event<wbr/>Names</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><a href="#eventNames.eventNames-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns an array listing the events for which the emitter has registered
|
|
173
|
-
listeners. The values in the array are strings or <code>Symbol</code>s.</p>
|
|
174
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEE</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {});</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'bar'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {});</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">sym</span><span class="hl-1"> = </span><span class="hl-0">Symbol</span><span class="hl-1">(</span><span class="hl-2">'symbol'</span><span class="hl-1">);</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-7">sym</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {});</span><br/><br/><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">eventNames</span><span class="hl-1">());</span><br/><span class="hl-5">// Prints: [ 'foo', 'bar', Symbol(symbol) ]</span>
|
|
175
|
-
</code><button>Copy</button></pre>
|
|
176
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v6.0.0</p>
|
|
177
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#eventNames">eventNames</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:900</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="every" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>every</span><a href="#every" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="every.every-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">every</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#every.every-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method is similar to <code>Array.prototype.every</code> and calls <em>fn</em> on each chunk in the stream
|
|
178
|
-
to check if all awaited return values are truthy value for <em>fn</em>. Once an <em>fn</em> call on a chunk
|
|
179
|
-
<code>await</code>ed return value is falsy, the stream is destroyed and the promise is fulfilled with <code>false</code>.
|
|
180
|
-
If all of the <em>fn</em> calls on the chunks return a truthy value, the promise is fulfilled with <code>true</code>.</p>
|
|
181
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to call on each chunk of the stream. Async or not.</p>
|
|
182
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>a promise evaluating to <code>true</code> if <em>fn</em> returned a truthy value for every one of the chunks.</p>
|
|
183
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
184
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#every">every</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:514</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="filter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>filter</span><a href="#filter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="filter.filter-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">filter</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#filter.filter-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method allows filtering the stream. For each chunk in the stream the <em>fn</em> function will be called
|
|
185
|
-
and if it returns a truthy value, the chunk will be passed to the result stream.
|
|
186
|
-
If the <em>fn</em> function returns a promise - that promise will be <code>await</code>ed.</p>
|
|
187
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to filter chunks from the stream. Async or not.</p>
|
|
188
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream filtered with the predicate <em>fn</em>.</p>
|
|
189
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.4.0, v16.14.0</p>
|
|
190
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#filter">filter</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:442</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="find" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find</span><a href="#find" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="find.find-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#find.find-1.T-1">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#find.find-1.T-1">T</a><span class="tsd-signature-symbol">></span><a href="#find.find-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method is similar to <code>Array.prototype.find</code> and calls <em>fn</em> on each chunk in the stream
|
|
191
|
-
to find a chunk with a truthy value for <em>fn</em>. Once an <em>fn</em> call's awaited return value is truthy,
|
|
192
|
-
the stream is destroyed and the promise is fulfilled with value for which <em>fn</em> returned a truthy value.
|
|
193
|
-
If all of the <em>fn</em> calls on the chunks return a falsy value, the promise is fulfilled with <code>undefined</code>.</p>
|
|
194
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="find.find-1.T-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-keyword"> is </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#find.find-1.T-1">T</a><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to call on each chunk of the stream. Async or not.</p>
|
|
195
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-keyword"> is </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#find.find-1.T-1">T</a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">data</span><span class="tsd-signature-keyword"> is </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#find.find-1.T-1">T</a></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#find.find-1.T-1">T</a><span class="tsd-signature-symbol">></span></h4><p>a promise evaluating to the first chunk for which <em>fn</em> evaluated with a truthy value,
|
|
196
|
-
or <code>undefined</code> if no element was found.</p>
|
|
197
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
198
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#find">find</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:497</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="find.find-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#find.find-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#find">find</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:501</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="flatMap" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>flat<wbr/>Map</span><a href="#flatMap" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="flatMap.flatMap-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">flat<wbr/>Map</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#flatMap.flatMap-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method returns a new stream by applying the given callback to each chunk of the stream
|
|
199
|
-
and then flattening the result.</p>
|
|
200
|
-
<p>It is possible to return a stream or another iterable or async iterable from <em>fn</em> and the result streams
|
|
201
|
-
will be merged (flattened) into the returned stream.</p>
|
|
202
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to map over every chunk in the stream. May be async. May be a stream or generator.</p>
|
|
203
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream flat-mapped with the function <em>fn</em>.</p>
|
|
204
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
205
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#flatMap">flatMap</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:528</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="forEach" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>for<wbr/>Each</span><a href="#forEach" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="forEach.forEach-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">for<wbr/>Each</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#forEach.forEach-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method allows iterating a stream. For each chunk in the stream the <em>fn</em> function will be called.
|
|
206
|
-
If the <em>fn</em> function returns a promise - that promise will be <code>await</code>ed.</p>
|
|
207
|
-
<p>This method is different from <code>for await...of</code> loops in that it can optionally process chunks concurrently.
|
|
208
|
-
In addition, a <code>forEach</code> iteration can only be stopped by having passed a <code>signal</code> option
|
|
209
|
-
and aborting the related AbortController while <code>for await...of</code> can be stopped with <code>break</code> or <code>return</code>.
|
|
210
|
-
In either case the stream will be destroyed.</p>
|
|
211
|
-
<p>This method is different from listening to the <code>'data'</code> event in that it uses the <code>readable</code> event
|
|
212
|
-
in the underlying machinary and can limit the number of concurrent <em>fn</em> calls.</p>
|
|
213
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to call on each chunk of the stream. Async or not.</p>
|
|
214
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>a promise for when the stream has finished.</p>
|
|
215
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
216
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#forEach">forEach</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:461</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="getMaxListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Max<wbr/>Listeners</span><a href="#getMaxListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="getMaxListeners.getMaxListeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Max<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#getMaxListeners.getMaxListeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the current max listener value for the <code>EventEmitter</code> which is either
|
|
217
|
-
set by <code>emitter.setMaxListeners(n)</code> or defaults to <a href="_internal_.Readable.html#defaultMaxListeners" class="tsd-kind-property">defaultMaxListeners</a>.</p>
|
|
218
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v1.0.0</p>
|
|
219
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#getMaxListeners">getMaxListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:752</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="isPaused" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Paused</span><a href="#isPaused" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="isPaused.isPaused-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Paused</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#isPaused.isPaused-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.isPaused()</code> method returns the current operating state of the <code>Readable</code>.
|
|
220
|
-
This is used primarily by the mechanism that underlies the <code>readable.pipe()</code> method.
|
|
221
|
-
In most typical cases, there will be no reason to use this method directly.</p>
|
|
222
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">readable</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">Readable</span><span class="hl-1">();</span><br/><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">isPaused</span><span class="hl-1">(); </span><span class="hl-5">// === false</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">pause</span><span class="hl-1">();</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">isPaused</span><span class="hl-1">(); </span><span class="hl-5">// === true</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">resume</span><span class="hl-1">();</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">isPaused</span><span class="hl-1">(); </span><span class="hl-5">// === false</span>
|
|
223
|
-
</code><button>Copy</button></pre>
|
|
224
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.11.14</p>
|
|
225
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#isPaused">isPaused</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:295</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="iterator" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>iterator</span><a href="#iterator" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="iterator.iterator-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">iterator</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#iterator.iterator-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The iterator created by this method gives users the option to cancel the destruction
|
|
226
|
-
of the stream if the <code>for await...of</code> loop is exited by <code>return</code>, <code>break</code>, or <code>throw</code>,
|
|
227
|
-
or if the iterator should destroy the stream if the stream emitted an error during iteration.</p>
|
|
228
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">destroyOnReturn</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">destroy<wbr/>On<wbr/>Return</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>When set to <code>false</code>, calling <code>return</code> on the async iterator,
|
|
229
|
-
or exiting a <code>for await...of</code> iteration using a <code>break</code>, <code>return</code>, or <code>throw</code> will not destroy the stream.
|
|
230
|
-
<strong>Default: <code>true</code></strong>.</p>
|
|
231
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v16.3.0</p>
|
|
232
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#iterator">iterator</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:425</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listenerCount" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>listener<wbr/>Count</span><a href="#listenerCount" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="listenerCount.listenerCount-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listener<wbr/>Count</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#listenerCount.listenerCount-1.K-1">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#listenerCount.listenerCount-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the number of listeners listening for the event named <code>eventName</code>.
|
|
233
|
-
If <code>listener</code> is provided, it will return how many times the listener is found
|
|
234
|
-
in the list of the listeners of the event.</p>
|
|
235
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="listenerCount.listenerCount-1.K-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event being listened for</p>
|
|
236
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-type">Function</span></span><div class="tsd-comment tsd-typography"><p>The event handler function</p>
|
|
237
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v3.2.0</p>
|
|
238
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#listenerCount">listenerCount</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:846</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>listeners</span><a href="#listeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="listeners.listeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#listeners.listeners-1.K-2">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span><a href="#listeners.listeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>.</p>
|
|
239
|
-
<pre><code class="language-js"><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">util</span><span class="hl-1">.</span><span class="hl-0">inspect</span><span class="hl-1">(</span><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">listeners</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">)));</span><br/><span class="hl-5">// Prints: [ [Function] ]</span>
|
|
240
|
-
</code><button>Copy</button></pre>
|
|
241
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="listeners.listeners-1.K-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.1.26</p>
|
|
242
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#listeners">listeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:765</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="map" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>map</span><a href="#map" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="map.map-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">map</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#map.map-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method allows mapping over the stream. The <em>fn</em> function will be called for every chunk in the stream.
|
|
243
|
-
If the <em>fn</em> function returns a promise - that promise will be <code>await</code>ed before being passed to the result stream.</p>
|
|
244
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to map over every chunk in the stream. Async or not.</p>
|
|
245
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream mapped with the function <em>fn</em>.</p>
|
|
246
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.4.0, v16.14.0</p>
|
|
247
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#map">map</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:433</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="off" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>off</span><a href="#off" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="off.off-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">off</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#off.off-1.K-3">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#off.off-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Alias for <code>emitter.removeListener()</code>.</p>
|
|
248
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="off.off-1.K-3" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v10.0.0</p>
|
|
249
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#off">off</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:725</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="on" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>on</span><a href="#on" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="on.on-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Adds the <code>listener</code> function to the end of the listeners array for the event
|
|
250
|
-
named <code>eventName</code>. No checks are made to see if the <code>listener</code> has already
|
|
251
|
-
been added. Multiple calls passing the same combination of <code>eventName</code> and
|
|
252
|
-
<code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
|
|
253
|
-
<pre><code class="language-js"><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
254
|
-
</code><button>Copy</button></pre>
|
|
255
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
256
|
-
<p>By default, event listeners are invoked in the order they are added. The <code>emitter.prependListener()</code> method can be used as an alternative to add the
|
|
257
|
-
event listener to the beginning of the listeners array.</p>
|
|
258
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEE</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'a'</span><span class="hl-1">));</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">prependListener</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'b'</span><span class="hl-1">));</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">);</span><br/><span class="hl-5">// Prints:</span><br/><span class="hl-5">// b</span><br/><span class="hl-5">// a</span>
|
|
259
|
-
</code><button>Copy</button></pre>
|
|
260
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
|
261
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
262
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.1.101</p>
|
|
263
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:614</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:615</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:616</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:617</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:618</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:619</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:620</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on.on-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#on.on-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on">on</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:621</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="once" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>once</span><a href="#once" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="once.once-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Adds a <strong>one-time</strong> <code>listener</code> function for the event named <code>eventName</code>. The
|
|
264
|
-
next time <code>eventName</code> is triggered, this listener is removed and then invoked.</p>
|
|
265
|
-
<pre><code class="language-js"><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Ah, we have our first user!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
266
|
-
</code><button>Copy</button></pre>
|
|
267
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
268
|
-
<p>By default, event listeners are invoked in the order they are added. The <code>emitter.prependOnceListener()</code> method can be used as an alternative to add the
|
|
269
|
-
event listener to the beginning of the listeners array.</p>
|
|
270
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEE</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'a'</span><span class="hl-1">));</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">prependOnceListener</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'b'</span><span class="hl-1">));</span><br/><span class="hl-7">myEE</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">);</span><br/><span class="hl-5">// Prints:</span><br/><span class="hl-5">// b</span><br/><span class="hl-5">// a</span>
|
|
271
|
-
</code><button>Copy</button></pre>
|
|
272
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
|
273
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
274
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.3.0</p>
|
|
275
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:622</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:623</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:624</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:625</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:626</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:627</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:628</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once.once-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#once.once-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once">once</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:629</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="pause" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>pause</span><a href="#pause" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="pause.pause-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pause</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#pause.pause-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.pause()</code> method will cause a stream in flowing mode to stop
|
|
276
|
-
emitting <code>'data'</code> events, switching out of flowing mode. Any data that
|
|
277
|
-
becomes available will remain in the internal buffer.</p>
|
|
278
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">readable</span><span class="hl-1"> = </span><span class="hl-0">getReadableStreamSomehow</span><span class="hl-1">();</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'data'</span><span class="hl-1">, (</span><span class="hl-7">chunk</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Received </span><span class="hl-3">${</span><span class="hl-7">chunk</span><span class="hl-10">.</span><span class="hl-7">length</span><span class="hl-3">}</span><span class="hl-2"> bytes of data.`</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">pause</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'There will be no additional data for 1 second.'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-0">setTimeout</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Now data will start flowing again.'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">resume</span><span class="hl-1">();</span><br/><span class="hl-1"> }, </span><span class="hl-9">1000</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
279
|
-
</code><button>Copy</button></pre>
|
|
280
|
-
<p>The <code>readable.pause()</code> method has no effect if there is a <code>'readable'</code> event listener.</p>
|
|
281
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
282
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#pause">pause</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:259</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="pipe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>pipe</span><a href="#pipe" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="pipe.pipe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pipe</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#pipe.pipe-1.T-2">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">destination</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#pipe.pipe-1.T-2">T</a><a href="#pipe.pipe-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="pipe.pipe-1.T-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/_internal_.WritableStream.html" class="tsd-signature-type tsd-kind-interface">WritableStream</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">destination</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#pipe.pipe-1.T-2">T</a></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">end</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">end</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#pipe.pipe-1.T-2">T</a></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#pipe">pipe</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:30</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="prependListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>prepend<wbr/>Listener</span><a href="#prependListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Adds the <code>listener</code> function to the <em>beginning</em> of the listeners array for the
|
|
283
|
-
event named <code>eventName</code>. No checks are made to see if the <code>listener</code> has
|
|
284
|
-
already been added. Multiple calls passing the same combination of <code>eventName</code>
|
|
285
|
-
and <code>listener</code> will result in the <code>listener</code> being added, and called, multiple times.</p>
|
|
286
|
-
<pre><code class="language-js"><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">prependListener</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
287
|
-
</code><button>Copy</button></pre>
|
|
288
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
289
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
|
290
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
291
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v6.0.0</p>
|
|
292
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:630</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:631</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:632</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:633</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:634</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:635</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:636</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependListener.prependListener-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependListener.prependListener-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependListener">prependListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:637</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="prependOnceListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>prepend<wbr/>Once<wbr/>Listener</span><a href="#prependOnceListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Adds a <strong>one-time</strong><code>listener</code> function for the event named <code>eventName</code> to the <em>beginning</em> of the listeners array. The next time <code>eventName</code> is triggered, this
|
|
293
|
-
listener is removed, and then invoked.</p>
|
|
294
|
-
<pre><code class="language-js"><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">prependOnceListener</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Ah, we have our first user!'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
295
|
-
</code><button>Copy</button></pre>
|
|
296
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
297
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span><div class="tsd-comment tsd-typography"><p>The name of the event.</p>
|
|
298
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>The callback function</p>
|
|
299
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v6.0.0</p>
|
|
300
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:638</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:639</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:640</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:641</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:642</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:643</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:644</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="prependOnceListener.prependOnceListener-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">prepend<wbr/>Once<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#prependOnceListener.prependOnceListener-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#prependOnceListener">prependOnceListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:645</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="push" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>push</span><a href="#push" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="push.push-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">push</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span>, <span class="tsd-kind-parameter">encoding</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#push.push-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">encoding</span>: <a href="../types/_internal_.BufferEncoding.html" class="tsd-signature-type tsd-kind-type-alias">BufferEncoding</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#push">push</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:415</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="rawListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>raw<wbr/>Listeners</span><a href="#rawListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="rawListeners.rawListeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">raw<wbr/>Listeners</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#rawListeners.rawListeners-1.K-4">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span><a href="#rawListeners.rawListeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>,
|
|
301
|
-
including any wrappers (such as those created by <code>.once()</code>).</p>
|
|
302
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">emitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-2">'log'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'log once'</span><span class="hl-1">));</span><br/><br/><span class="hl-5">// Returns a new Array with a function `onceWrapper` which has a property</span><br/><span class="hl-5">// `listener` which contains the original listener bound above</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">listeners</span><span class="hl-1"> = </span><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">rawListeners</span><span class="hl-1">(</span><span class="hl-2">'log'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">logFnWrapper</span><span class="hl-1"> = </span><span class="hl-7">listeners</span><span class="hl-1">[</span><span class="hl-9">0</span><span class="hl-1">];</span><br/><br/><span class="hl-5">// Logs "log once" to the console and does not unbind the `once` event</span><br/><span class="hl-7">logFnWrapper</span><span class="hl-1">.</span><span class="hl-0">listener</span><span class="hl-1">();</span><br/><br/><span class="hl-5">// Logs "log once" to the console and removes the listener</span><br/><span class="hl-0">logFnWrapper</span><span class="hl-1">();</span><br/><br/><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'log'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'log persistently'</span><span class="hl-1">));</span><br/><span class="hl-5">// Will return a new Array with a single function bound by `.on()` above</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">newListeners</span><span class="hl-1"> = </span><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">rawListeners</span><span class="hl-1">(</span><span class="hl-2">'log'</span><span class="hl-1">);</span><br/><br/><span class="hl-5">// Logs "log persistently" twice</span><br/><span class="hl-7">newListeners</span><span class="hl-1">[</span><span class="hl-9">0</span><span class="hl-1">]();</span><br/><span class="hl-7">emitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'log'</span><span class="hl-1">);</span>
|
|
303
|
-
</code><button>Copy</button></pre>
|
|
304
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="rawListeners.rawListeners-1.K-4" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v9.4.0</p>
|
|
305
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#rawListeners">rawListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:796</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="read" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read</span><a href="#read" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="read.read-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">read</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">size</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><a href="#read.read-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.read()</code> method reads data out of the internal buffer and
|
|
306
|
-
returns it. If no data is available to be read, <code>null</code> is returned. By default,
|
|
307
|
-
the data is returned as a <code>Buffer</code> object unless an encoding has been
|
|
308
|
-
specified using the <code>readable.setEncoding()</code> method or the stream is operating
|
|
309
|
-
in object mode.</p>
|
|
310
|
-
<p>The optional <code>size</code> argument specifies a specific number of bytes to read. If
|
|
311
|
-
<code>size</code> bytes are not available to be read, <code>null</code> will be returned <em>unless</em> the
|
|
312
|
-
stream has ended, in which case all of the data remaining in the internal buffer
|
|
313
|
-
will be returned.</p>
|
|
314
|
-
<p>If the <code>size</code> argument is not specified, all of the data contained in the
|
|
315
|
-
internal buffer will be returned.</p>
|
|
316
|
-
<p>The <code>size</code> argument must be less than or equal to 1 GiB.</p>
|
|
317
|
-
<p>The <code>readable.read()</code> method should only be called on <code>Readable</code> streams
|
|
318
|
-
operating in paused mode. In flowing mode, <code>readable.read()</code> is called
|
|
319
|
-
automatically until the internal buffer is fully drained.</p>
|
|
320
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">readable</span><span class="hl-1"> = </span><span class="hl-0">getReadableStreamSomehow</span><span class="hl-1">();</span><br/><br/><span class="hl-5">// 'readable' may be triggered multiple times as data is buffered in</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'readable'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-7">chunk</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Stream is readable (new data received in buffer)'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">// Use a loop to make sure we read all currently available data</span><br/><span class="hl-1"> </span><span class="hl-6">while</span><span class="hl-1"> (</span><span class="hl-3">null</span><span class="hl-1"> !== (</span><span class="hl-7">chunk</span><span class="hl-1"> = </span><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">read</span><span class="hl-1">())) {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Read </span><span class="hl-3">${</span><span class="hl-7">chunk</span><span class="hl-10">.</span><span class="hl-7">length</span><span class="hl-3">}</span><span class="hl-2"> bytes of data...`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">// 'end' will be triggered once when there is no more data available</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'end'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Reached end of stream.'</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
321
|
-
</code><button>Copy</button></pre>
|
|
322
|
-
<p>Each call to <code>readable.read()</code> returns a chunk of data, or <code>null</code>. The chunks
|
|
323
|
-
are not concatenated. A <code>while</code> loop is necessary to consume all data
|
|
324
|
-
currently in the buffer. When reading a large file <code>.read()</code> may return <code>null</code>,
|
|
325
|
-
having consumed all buffered content so far, but there is still more data to
|
|
326
|
-
come not yet buffered. In this case a new <code>'readable'</code> event will be emitted
|
|
327
|
-
when there is more data in the buffer. Finally the <code>'end'</code> event will be
|
|
328
|
-
emitted when there is no more data to come.</p>
|
|
329
|
-
<p>Therefore to read a file's whole contents from a <code>readable</code>, it is necessary
|
|
330
|
-
to collect chunks across multiple <code>'readable'</code> events:</p>
|
|
331
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">chunks</span><span class="hl-1"> = [];</span><br/><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'readable'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-7">chunk</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-6">while</span><span class="hl-1"> (</span><span class="hl-3">null</span><span class="hl-1"> !== (</span><span class="hl-7">chunk</span><span class="hl-1"> = </span><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">read</span><span class="hl-1">())) {</span><br/><span class="hl-1"> </span><span class="hl-7">chunks</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">(</span><span class="hl-7">chunk</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'end'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">content</span><span class="hl-1"> = </span><span class="hl-7">chunks</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-2">''</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
332
|
-
</code><button>Copy</button></pre>
|
|
333
|
-
<p>A <code>Readable</code> stream in object mode will always return a single item from
|
|
334
|
-
a call to <code>readable.read(size)</code>, regardless of the value of the <code>size</code> argument.</p>
|
|
335
|
-
<p>If the <code>readable.read()</code> method returns a chunk of data, a <code>'data'</code> event will
|
|
336
|
-
also be emitted.</p>
|
|
337
|
-
<p>Calling <a href="_internal_.ReadableBase.html#read" class="tsd-kind-method">read</a> after the <code>'end'</code> event has
|
|
338
|
-
been emitted will return <code>null</code>. No runtime error will be raised.</p>
|
|
339
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">size</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Optional argument to specify how much data to read.</p>
|
|
340
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
341
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#read">read</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:212</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="reduce" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>reduce</span><a href="#reduce" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="reduce.reduce-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">reduce</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#reduce.reduce-1.T-3">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-1.T-3">T</a><span class="tsd-signature-symbol">></span><a href="#reduce.reduce-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method calls <em>fn</em> on each chunk of the stream in order, passing it the result from the calculation
|
|
342
|
-
on the previous element. It returns a promise for the final value of the reduction.</p>
|
|
343
|
-
<p>If no <em>initial</em> value is supplied the first chunk of the stream is used as the initial value.
|
|
344
|
-
If the stream is empty, the promise is rejected with a <code>TypeError</code> with the <code>ERR_INVALID_ARGS</code> code property.</p>
|
|
345
|
-
<p>The reducer function iterates the stream element-by-element which means that there is no <em>concurrency</em> parameter
|
|
346
|
-
or parallelism. To perform a reduce concurrently, you can extract the async function to <code>readable.map</code> method.</p>
|
|
347
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="reduce.reduce-1.T-3" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">previous</span>, <span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-1.T-3">T</a><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a reducer function to call over every chunk in the stream. Async or not.</p>
|
|
348
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">previous</span>, <span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-1.T-3">T</a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">previous</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-1.T-3">T</a></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">undefined</span></span><div class="tsd-comment tsd-typography"><p>the initial value to use in the reduction.</p>
|
|
349
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-1.T-3">T</a><span class="tsd-signature-symbol">></span></h4><p>a promise for the final value of the reduction.</p>
|
|
350
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
351
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#reduce">reduce</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:564</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="reduce.reduce-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">reduce</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.Readable.html#reduce.reduce-2.T-4">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">initial</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a><span class="tsd-signature-symbol">></span><a href="#reduce.reduce-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="reduce.reduce-2.T-4" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">previous</span>, <span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">previous</span>, <span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">previous</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a></span></li><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a></h4></li></ul></li></ul></li><li><span><span class="tsd-kind-parameter">initial</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="_internal_.IncomingMessage.html#reduce.reduce-2.T-4">T</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#reduce">reduce</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:569</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="removeAllListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>All<wbr/>Listeners</span><a href="#removeAllListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="removeAllListeners.removeAllListeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>All<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeAllListeners.removeAllListeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Removes all listeners, or those of the specified <code>eventName</code>.</p>
|
|
352
|
-
<p>It is bad practice to remove listeners added elsewhere in the code,
|
|
353
|
-
particularly when the <code>EventEmitter</code> instance was created by some other
|
|
354
|
-
component or module (e.g. sockets or file streams).</p>
|
|
355
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
356
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.1.26</p>
|
|
357
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeAllListeners">removeAllListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:736</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="removeListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Listener</span><a href="#removeListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Removes the specified <code>listener</code> from the listener array for the event named <code>eventName</code>.</p>
|
|
358
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">callback</span><span class="hl-1"> = (</span><span class="hl-7">stream</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'someone connected!'</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, </span><span class="hl-7">callback</span><span class="hl-1">);</span><br/><span class="hl-5">// ...</span><br/><span class="hl-7">server</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-2">'connection'</span><span class="hl-1">, </span><span class="hl-7">callback</span><span class="hl-1">);</span>
|
|
359
|
-
</code><button>Copy</button></pre>
|
|
360
|
-
<p><code>removeListener()</code> will remove, at most, one instance of a listener from the
|
|
361
|
-
listener array. If any single listener has been added multiple times to the
|
|
362
|
-
listener array for the specified <code>eventName</code>, then <code>removeListener()</code> must be
|
|
363
|
-
called multiple times to remove each instance.</p>
|
|
364
|
-
<p>Once an event is emitted, all listeners attached to it at the
|
|
365
|
-
time of emitting are called in order. This implies that any <code>removeListener()</code> or <code>removeAllListeners()</code> calls <em>after</em> emitting and <em>before</em> the last listener finishes execution
|
|
366
|
-
will not remove them from<code>emit()</code> in progress. Subsequent events behave as expected.</p>
|
|
367
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">class</span><span class="hl-1"> </span><span class="hl-8">MyEmitter</span><span class="hl-1"> </span><span class="hl-3">extends</span><span class="hl-1"> </span><span class="hl-8">EventEmitter</span><span class="hl-1"> {}</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEmitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">MyEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">callbackA</span><span class="hl-1"> = () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'A'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-7">callbackB</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">callbackB</span><span class="hl-1"> = () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'B'</span><span class="hl-1">);</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-7">callbackA</span><span class="hl-1">);</span><br/><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, </span><span class="hl-7">callbackB</span><span class="hl-1">);</span><br/><br/><span class="hl-5">// callbackA removes listener callbackB but it will still be called.</span><br/><span class="hl-5">// Internal listener array at time of emit [callbackA, callbackB]</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">);</span><br/><span class="hl-5">// Prints:</span><br/><span class="hl-5">// A</span><br/><span class="hl-5">// B</span><br/><br/><span class="hl-5">// callbackB is now removed.</span><br/><span class="hl-5">// Internal listener array [callbackA]</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">);</span><br/><span class="hl-5">// Prints:</span><br/><span class="hl-5">// A</span>
|
|
368
|
-
</code><button>Copy</button></pre>
|
|
369
|
-
<p>Because listeners are managed using an internal array, calling this will
|
|
370
|
-
change the position indices of any listener registered <em>after</em> the listener
|
|
371
|
-
being removed. This will not impact the order in which listeners are called,
|
|
372
|
-
but it means that any copies of the listener array as returned by
|
|
373
|
-
the <code>emitter.listeners()</code> method will need to be recreated.</p>
|
|
374
|
-
<p>When a single function has been added as a handler multiple times for a single
|
|
375
|
-
event (as in the example below), <code>removeListener()</code> will remove the most
|
|
376
|
-
recently added instance. In the example the <code>once('ping')</code> listener is removed:</p>
|
|
377
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">pong</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'pong'</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'ping'</span><span class="hl-1">, </span><span class="hl-7">pong</span><span class="hl-1">);</span><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-2">'ping'</span><span class="hl-1">, </span><span class="hl-7">pong</span><span class="hl-1">);</span><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-2">'ping'</span><span class="hl-1">, </span><span class="hl-7">pong</span><span class="hl-1">);</span><br/><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'ping'</span><span class="hl-1">);</span><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'ping'</span><span class="hl-1">);</span>
|
|
378
|
-
</code><button>Copy</button></pre>
|
|
379
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
380
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"close"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.1.26</p>
|
|
381
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:646</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"data"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:647</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"end"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:648</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"error"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">err</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">err</span>: <a href="../interfaces/_internal_.Error.html" class="tsd-signature-type tsd-kind-interface">Error</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:649</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"pause"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:650</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"readable"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:651</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-7" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">"resume"</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:652</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="removeListener.removeListener-8" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span>, <span class="tsd-kind-parameter">listener</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeListener.removeListener-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><span class="tsd-kind-parameter">listener</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#removeListener">removeListener</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:653</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="resume" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>resume</span><a href="#resume" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="resume.resume-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">resume</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#resume.resume-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.resume()</code> method causes an explicitly paused <code>Readable</code> stream to
|
|
382
|
-
resume emitting <code>'data'</code> events, switching the stream into flowing mode.</p>
|
|
383
|
-
<p>The <code>readable.resume()</code> method can be used to fully consume the data from a
|
|
384
|
-
stream without actually processing any of that data:</p>
|
|
385
|
-
<pre><code class="language-js"><span class="hl-0">getReadableStreamSomehow</span><span class="hl-1">()</span><br/><span class="hl-1"> .</span><span class="hl-0">resume</span><span class="hl-1">()</span><br/><span class="hl-1"> .</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'end'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Reached the end, but did not read anything.'</span><span class="hl-1">);</span><br/><span class="hl-1"> });</span>
|
|
386
|
-
</code><button>Copy</button></pre>
|
|
387
|
-
<p>The <code>readable.resume()</code> method has no effect if there is a <code>'readable'</code> event listener.</p>
|
|
388
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
389
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#resume">resume</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:278</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="setEncoding" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Encoding</span><a href="#setEncoding" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="setEncoding.setEncoding-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Encoding</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">encoding</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#setEncoding.setEncoding-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.setEncoding()</code> method sets the character encoding for
|
|
390
|
-
data read from the <code>Readable</code> stream.</p>
|
|
391
|
-
<p>By default, no encoding is assigned and stream data will be returned as <code>Buffer</code> objects. Setting an encoding causes the stream data
|
|
392
|
-
to be returned as strings of the specified encoding rather than as <code>Buffer</code> objects. For instance, calling <code>readable.setEncoding('utf8')</code> will cause the
|
|
393
|
-
output data to be interpreted as UTF-8 data, and passed as strings. Calling <code>readable.setEncoding('hex')</code> will cause the data to be encoded in hexadecimal
|
|
394
|
-
string format.</p>
|
|
395
|
-
<p>The <code>Readable</code> stream will properly handle multi-byte characters delivered
|
|
396
|
-
through the stream that would otherwise become improperly decoded if simply
|
|
397
|
-
pulled from the stream as <code>Buffer</code> objects.</p>
|
|
398
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">readable</span><span class="hl-1"> = </span><span class="hl-0">getReadableStreamSomehow</span><span class="hl-1">();</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">setEncoding</span><span class="hl-1">(</span><span class="hl-2">'utf8'</span><span class="hl-1">);</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'data'</span><span class="hl-1">, (</span><span class="hl-7">chunk</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">assert</span><span class="hl-1">.</span><span class="hl-0">equal</span><span class="hl-1">(</span><span class="hl-3">typeof</span><span class="hl-1"> </span><span class="hl-7">chunk</span><span class="hl-1">, </span><span class="hl-2">'string'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Got %d characters of string data:'</span><span class="hl-1">, </span><span class="hl-7">chunk</span><span class="hl-1">.</span><span class="hl-7">length</span><span class="hl-1">);</span><br/><span class="hl-1">});</span>
|
|
399
|
-
</code><button>Copy</button></pre>
|
|
400
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">encoding</span>: <a href="../types/_internal_.BufferEncoding.html" class="tsd-signature-type tsd-kind-type-alias">BufferEncoding</a></span><div class="tsd-comment tsd-typography"><p>The encoding to use.</p>
|
|
401
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
402
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#setEncoding">setEncoding</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:237</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="setMaxListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Max<wbr/>Listeners</span><a href="#setMaxListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="setMaxListeners.setMaxListeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Max<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">n</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#setMaxListeners.setMaxListeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>By default <code>EventEmitter</code>s will print a warning if more than <code>10</code> listeners are
|
|
403
|
-
added for a particular event. This is a useful default that helps finding
|
|
404
|
-
memory leaks. The <code>emitter.setMaxListeners()</code> method allows the limit to be
|
|
405
|
-
modified for this specific <code>EventEmitter</code> instance. The value can be set to <code>Infinity</code> (or <code>0</code>) to indicate an unlimited number of listeners.</p>
|
|
406
|
-
<p>Returns a reference to the <code>EventEmitter</code>, so that calls can be chained.</p>
|
|
407
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">n</span>: <span class="tsd-signature-type">number</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.3.5</p>
|
|
408
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#setMaxListeners">setMaxListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:746</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="some" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>some</span><a href="#some" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="some.some-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">some</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#some.some-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method is similar to <code>Array.prototype.some</code> and calls <em>fn</em> on each chunk in the stream
|
|
409
|
-
until the awaited return value is <code>true</code> (or any truthy value). Once an <em>fn</em> call on a chunk
|
|
410
|
-
<code>await</code>ed return value is truthy, the stream is destroyed and the promise is fulfilled with <code>true</code>.
|
|
411
|
-
If none of the <em>fn</em> calls on the chunks return a truthy value, the promise is fulfilled with <code>false</code>.</p>
|
|
412
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>a function to call on each chunk of the stream. Async or not.</p>
|
|
413
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>a promise evaluating to <code>true</code> if <em>fn</em> returned a truthy value for at least one of the chunks.</p>
|
|
414
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
415
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#some">some</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:483</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="take" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>take</span><a href="#take" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="take.take-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">take</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">limit</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#take.take-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method returns a new stream with the first <em>limit</em> chunks.</p>
|
|
416
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">limit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>the number of chunks to take from the readable.</p>
|
|
417
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><p>a stream with <em>limit</em> chunks taken.</p>
|
|
418
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
419
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#take">take</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:542</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="toArray" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>to<wbr/>Array</span><a href="#toArray" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="toArray.toArray-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">to<wbr/>Array</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#toArray.toArray-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This method allows easily obtaining the contents of a stream.</p>
|
|
420
|
-
<p>As this method reads the entire stream into memory, it negates the benefits of streams. It's intended
|
|
421
|
-
for interoperability and convenience, not as the primary way to consume streams.</p>
|
|
422
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ArrayOptions.html" class="tsd-signature-type tsd-kind-interface">ArrayOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>a promise containing an array with the contents of the stream.</p>
|
|
423
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.5.0</p>
|
|
424
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#toArray">toArray</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:473</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="unpipe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>unpipe</span><a href="#unpipe" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="unpipe.unpipe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">unpipe</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">destination</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#unpipe.unpipe-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The <code>readable.unpipe()</code> method detaches a <code>Writable</code> stream previously attached
|
|
425
|
-
using the <a href="_internal_.ReadableBase.html#pipe" class="tsd-kind-method">pipe</a> method.</p>
|
|
426
|
-
<p>If the <code>destination</code> is not specified, then <em>all</em> pipes are detached.</p>
|
|
427
|
-
<p>If the <code>destination</code> is specified, but no pipe is set up for it, then
|
|
428
|
-
the method does nothing.</p>
|
|
429
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">fs</span><span class="hl-1"> = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'node:fs'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">readable</span><span class="hl-1"> = </span><span class="hl-0">getReadableStreamSomehow</span><span class="hl-1">();</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">writable</span><span class="hl-1"> = </span><span class="hl-7">fs</span><span class="hl-1">.</span><span class="hl-0">createWriteStream</span><span class="hl-1">(</span><span class="hl-2">'file.txt'</span><span class="hl-1">);</span><br/><span class="hl-5">// All the data from readable goes into 'file.txt',</span><br/><span class="hl-5">// but only for the first second.</span><br/><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">pipe</span><span class="hl-1">(</span><span class="hl-7">writable</span><span class="hl-1">);</span><br/><span class="hl-0">setTimeout</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Stop writing to file.txt.'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">readable</span><span class="hl-1">.</span><span class="hl-0">unpipe</span><span class="hl-1">(</span><span class="hl-7">writable</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Manually close the file stream.'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">writable</span><span class="hl-1">.</span><span class="hl-0">end</span><span class="hl-1">();</span><br/><span class="hl-1">}, </span><span class="hl-9">1000</span><span class="hl-1">);</span>
|
|
430
|
-
</code><button>Copy</button></pre>
|
|
431
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">destination</span>: <a href="../interfaces/_internal_.WritableStream.html" class="tsd-signature-type tsd-kind-interface">WritableStream</a></span><div class="tsd-comment tsd-typography"><p>Optional specific stream to unpipe</p>
|
|
432
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
433
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#unpipe">unpipe</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:322</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="unshift" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>unshift</span><a href="#unshift" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="unshift.unshift-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">unshift</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">chunk</span>, <span class="tsd-kind-parameter">encoding</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#unshift.unshift-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Passing <code>chunk</code> as <code>null</code> signals the end of the stream (EOF) and behaves the
|
|
434
|
-
same as <code>readable.push(null)</code>, after which no more data can be written. The EOF
|
|
435
|
-
signal is put at the end of the buffer and any buffered data will still be
|
|
436
|
-
flushed.</p>
|
|
437
|
-
<p>The <code>readable.unshift()</code> method pushes a chunk of data back into the internal
|
|
438
|
-
buffer. This is useful in certain situations where a stream is being consumed by
|
|
439
|
-
code that needs to "un-consume" some amount of data that it has optimistically
|
|
440
|
-
pulled out of the source, so that the data can be passed on to some other party.</p>
|
|
441
|
-
<p>The <code>stream.unshift(chunk)</code> method cannot be called after the <code>'end'</code> event
|
|
442
|
-
has been emitted or a runtime error will be thrown.</p>
|
|
443
|
-
<p>Developers using <code>stream.unshift()</code> often should consider switching to
|
|
444
|
-
use of a <code>Transform</code> stream instead. See the <code>API for stream implementers</code> section for more information.</p>
|
|
445
|
-
<pre><code class="language-js"><span class="hl-5">// Pull off a header delimited by \n\n.</span><br/><span class="hl-5">// Use unshift() if we get too much.</span><br/><span class="hl-5">// Call the callback with (error, header, stream).</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">StringDecoder</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'node:string_decoder'</span><span class="hl-1">);</span><br/><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">parseHeader</span><span class="hl-1">(</span><span class="hl-7">stream</span><span class="hl-1">, </span><span class="hl-7">callback</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'error'</span><span class="hl-1">, </span><span class="hl-7">callback</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'readable'</span><span class="hl-1">, </span><span class="hl-7">onReadable</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">decoder</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">StringDecoder</span><span class="hl-1">(</span><span class="hl-2">'utf8'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-7">header</span><span class="hl-1"> = </span><span class="hl-2">''</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">onReadable</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-7">chunk</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-6">while</span><span class="hl-1"> (</span><span class="hl-3">null</span><span class="hl-1"> !== (</span><span class="hl-7">chunk</span><span class="hl-1"> = </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">read</span><span class="hl-1">())) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">str</span><span class="hl-1"> = </span><span class="hl-7">decoder</span><span class="hl-1">.</span><span class="hl-0">write</span><span class="hl-1">(</span><span class="hl-7">chunk</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">if</span><span class="hl-1"> (</span><span class="hl-7">str</span><span class="hl-1">.</span><span class="hl-0">includes</span><span class="hl-1">(</span><span class="hl-2">'</span><span class="hl-11">\n\n</span><span class="hl-2">'</span><span class="hl-1">)) {</span><br/><span class="hl-1"> </span><span class="hl-5">// Found the header boundary.</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">split</span><span class="hl-1"> = </span><span class="hl-7">str</span><span class="hl-1">.</span><span class="hl-0">split</span><span class="hl-1">(</span><span class="hl-12">/\n\n/</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">header</span><span class="hl-1"> += </span><span class="hl-7">split</span><span class="hl-1">.</span><span class="hl-0">shift</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">remaining</span><span class="hl-1"> = </span><span class="hl-7">split</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-2">'</span><span class="hl-11">\n\n</span><span class="hl-2">'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">buf</span><span class="hl-1"> = </span><span class="hl-7">Buffer</span><span class="hl-1">.</span><span class="hl-0">from</span><span class="hl-1">(</span><span class="hl-7">remaining</span><span class="hl-1">, </span><span class="hl-2">'utf8'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-2">'error'</span><span class="hl-1">, </span><span class="hl-7">callback</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">// Remove the 'readable' listener before unshifting.</span><br/><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">removeListener</span><span class="hl-1">(</span><span class="hl-2">'readable'</span><span class="hl-1">, </span><span class="hl-7">onReadable</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">if</span><span class="hl-1"> (</span><span class="hl-7">buf</span><span class="hl-1">.</span><span class="hl-7">length</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-7">stream</span><span class="hl-1">.</span><span class="hl-0">unshift</span><span class="hl-1">(</span><span class="hl-7">buf</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">// Now the body of the message can be read from the stream.</span><br/><span class="hl-1"> </span><span class="hl-0">callback</span><span class="hl-1">(</span><span class="hl-3">null</span><span class="hl-1">, </span><span class="hl-7">header</span><span class="hl-1">, </span><span class="hl-7">stream</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">// Still reading the header.</span><br/><span class="hl-1"> </span><span class="hl-7">header</span><span class="hl-1"> += </span><span class="hl-7">str</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
|
446
|
-
</code><button>Copy</button></pre>
|
|
447
|
-
<p>Unlike <a href="_internal_.ReadableBase.html#push" class="tsd-kind-method">push</a>, <code>stream.unshift(chunk)</code> will not
|
|
448
|
-
end the reading process by resetting the internal reading state of the stream.
|
|
449
|
-
This can cause unexpected results if <code>readable.unshift()</code> is called during a
|
|
450
|
-
read (i.e. from within a <a href="_internal_.ReadableBase.html#_read" class="tsd-kind-method">_read</a> implementation on a
|
|
451
|
-
custom stream). Following the call to <code>readable.unshift()</code> with an immediate <a href="_internal_.ReadableBase.html#push" class="tsd-kind-method">push</a> will reset the reading state appropriately,
|
|
452
|
-
however it is best to simply avoid calling <code>readable.unshift()</code> while in the
|
|
453
|
-
process of performing a read.</p>
|
|
454
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">chunk</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>Chunk of data to unshift onto the read queue. For streams not operating in object mode, <code>chunk</code> must
|
|
455
|
-
be a {string}, {Buffer}, {TypedArray}, {DataView} or <code>null</code>. For object mode streams, <code>chunk</code> may be any JavaScript value.</p>
|
|
456
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">encoding</span>: <a href="../types/_internal_.BufferEncoding.html" class="tsd-signature-type tsd-kind-type-alias">BufferEncoding</a></span><div class="tsd-comment tsd-typography"><p>Encoding of string chunks. Must be a valid <code>Buffer</code> encoding, such as <code>'utf8'</code> or <code>'ascii'</code>.</p>
|
|
457
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.11</p>
|
|
458
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#unshift">unshift</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:388</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="wrap" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wrap</span><a href="#wrap" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="wrap.wrap-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">wrap</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">stream</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#wrap.wrap-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Prior to Node.js 0.10, streams did not implement the entire <code>node:stream</code> module API as it is currently defined. (See <code>Compatibility</code> for more
|
|
459
|
-
information.)</p>
|
|
460
|
-
<p>When using an older Node.js library that emits <code>'data'</code> events and has a <a href="_internal_.ReadableBase.html#pause" class="tsd-kind-method">pause</a> method that is advisory only, the <code>readable.wrap()</code> method can be used to create a <code>Readable</code>
|
|
461
|
-
stream that uses
|
|
462
|
-
the old stream as its data source.</p>
|
|
463
|
-
<p>It will rarely be necessary to use <code>readable.wrap()</code> but the method has been
|
|
464
|
-
provided as a convenience for interacting with older Node.js applications and
|
|
465
|
-
libraries.</p>
|
|
466
|
-
<pre><code class="language-js"><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">OldReader</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'./old-api-module.js'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">Readable</span><span class="hl-1"> } = </span><span class="hl-0">require</span><span class="hl-1">(</span><span class="hl-2">'node:stream'</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">oreader</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">OldReader</span><span class="hl-1">();</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myReader</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Readable</span><span class="hl-1">().</span><span class="hl-0">wrap</span><span class="hl-1">(</span><span class="hl-7">oreader</span><span class="hl-1">);</span><br/><br/><span class="hl-7">myReader</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'readable'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">myReader</span><span class="hl-1">.</span><span class="hl-0">read</span><span class="hl-1">(); </span><span class="hl-5">// etc.</span><br/><span class="hl-1">});</span>
|
|
467
|
-
</code><button>Copy</button></pre>
|
|
468
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">stream</span>: <a href="../interfaces/_internal_.ReadableStream-1.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a></span><div class="tsd-comment tsd-typography"><p>An "old style" readable stream</p>
|
|
469
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.4</p>
|
|
470
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#wrap">wrap</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:414</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="addAbortListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>add<wbr/>Abort<wbr/>Listener</span><a href="#addAbortListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="addAbortListener.addAbortListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Abort<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signal</span>, <span class="tsd-kind-parameter">resource</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.Disposable.html" class="tsd-signature-type tsd-kind-interface">Disposable</a><a href="#addAbortListener.addAbortListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><code class="tsd-tag ts-flagExperimental">Experimental</code> <div class="tsd-comment tsd-typography"><p>Listens once to the <code>abort</code> event on the provided <code>signal</code>.</p>
|
|
471
|
-
<p>Listening to the <code>abort</code> event on abort signals is unsafe and may
|
|
472
|
-
lead to resource leaks since another third party with the signal can
|
|
473
|
-
call <code>e.stopImmediatePropagation()</code>. Unfortunately Node.js cannot change
|
|
474
|
-
this since it would violate the web standard. Additionally, the original
|
|
475
|
-
API makes it easy to forget to remove listeners.</p>
|
|
476
|
-
<p>This API allows safely using <code>AbortSignal</code>s in Node.js APIs by solving these
|
|
477
|
-
two issues by listening to the event such that <code>stopImmediatePropagation</code> does
|
|
478
|
-
not prevent the listener from running.</p>
|
|
479
|
-
<p>Returns a disposable so that it may be unsubscribed from more easily.</p>
|
|
480
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">addAbortListener</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">example</span><span class="hl-1">(</span><span class="hl-7">signal</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-7">disposable</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-6">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">signal</span><span class="hl-1">.</span><span class="hl-0">addEventListener</span><span class="hl-1">(</span><span class="hl-2">'abort'</span><span class="hl-1">, (</span><span class="hl-7">e</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">e</span><span class="hl-1">.</span><span class="hl-0">stopImmediatePropagation</span><span class="hl-1">());</span><br/><span class="hl-1"> </span><span class="hl-7">disposable</span><span class="hl-1"> = </span><span class="hl-0">addAbortListener</span><span class="hl-1">(</span><span class="hl-7">signal</span><span class="hl-1">, (</span><span class="hl-7">e</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">// Do something when signal is aborted.</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> } </span><span class="hl-6">finally</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">disposable</span><span class="hl-1">?.[</span><span class="hl-7">Symbol</span><span class="hl-1">.</span><span class="hl-7">dispose</span><span class="hl-1">]();</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
|
481
|
-
</code><button>Copy</button></pre>
|
|
482
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signal</span>: <span class="tsd-signature-type">AbortSignal</span></span></li><li><span><span class="tsd-kind-parameter">resource</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">Event</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.Disposable.html" class="tsd-signature-type tsd-kind-interface">Disposable</a></h4><p>Disposable that removes the <code>abort</code> listener.</p>
|
|
483
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v20.5.0</p>
|
|
484
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#addAbortListener">addAbortListener</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:415</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="from" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>from</span><a href="#from" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="from.from-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">from</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">iterable</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#from.from-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>A utility method for creating Readable Streams out of iterators.</p>
|
|
485
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">iterable</span>: <a href="../interfaces/_internal_.Iterable.html" class="tsd-signature-type tsd-kind-interface">Iterable</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.AsyncIterable.html" class="tsd-signature-type tsd-kind-interface">AsyncIterable</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>Object implementing the <code>Symbol.asyncIterator</code> or <code>Symbol.iterator</code> iterable protocol. Emits an 'error' event if a null value is passed.</p>
|
|
486
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.ReadableOptions.html" class="tsd-signature-type tsd-kind-interface">ReadableOptions</a></span><div class="tsd-comment tsd-typography"><p>Options provided to <code>new stream.Readable([options])</code>. By default, <code>Readable.from()</code> will set <code>options.objectMode</code> to <code>true</code>, unless this is explicitly opted out by setting <code>options.objectMode</code> to <code>false</code>.</p>
|
|
487
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v12.3.0, v10.17.0</p>
|
|
488
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#from">from</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:60</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><a id="fromWeb" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>from<wbr/>Web</span><a href="#fromWeb" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="fromWeb.fromWeb-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">from<wbr/>Web</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">readableStream</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><a href="#fromWeb.fromWeb-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><code class="tsd-tag ts-flagExperimental">Experimental</code> <div class="tsd-comment tsd-typography"><p>A utility method for creating a <code>Readable</code> from a web <code>ReadableStream</code>.</p>
|
|
489
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">readableStream</span>: <a href="../interfaces/_internal_.ReadableStream.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.ReadableOptions.html" class="tsd-signature-type tsd-kind-interface">ReadableOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"encoding"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"highWaterMark"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"objectMode"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.0.0</p>
|
|
490
|
-
</div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/stream.d.ts:975</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="getEventListeners" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>get<wbr/>Event<wbr/>Listeners</span><a href="#getEventListeners" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="getEventListeners.getEventListeners-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Event<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">name</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span><a href="#getEventListeners.getEventListeners-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a copy of the array of listeners for the event named <code>eventName</code>.</p>
|
|
491
|
-
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.listeners</code> on
|
|
492
|
-
the emitter.</p>
|
|
493
|
-
<p>For <code>EventTarget</code>s this is the only way to get the event listeners for the
|
|
494
|
-
event target. This is useful for debugging and diagnostic purposes.</p>
|
|
495
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">getEventListeners</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">listener</span><span class="hl-1"> = () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Events are fun'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-7">listener</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getEventListeners</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'foo'</span><span class="hl-1">)); </span><span class="hl-5">// [ [Function: listener] ]</span><br/><span class="hl-1">}</span><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">et</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventTarget</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">listener</span><span class="hl-1"> = () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Events are fun'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">et</span><span class="hl-1">.</span><span class="hl-0">addEventListener</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-7">listener</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getEventListeners</span><span class="hl-1">(</span><span class="hl-7">et</span><span class="hl-1">, </span><span class="hl-2">'foo'</span><span class="hl-1">)); </span><span class="hl-5">// [ [Function: listener] ]</span><br/><span class="hl-1">}</span>
|
|
496
|
-
</code><button>Copy</button></pre>
|
|
497
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v15.2.0, v14.17.0</p>
|
|
498
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#getEventListeners">getEventListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:336</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="getMaxListeners-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>get<wbr/>Max<wbr/>Listeners</span><a href="#getMaxListeners-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="getMaxListeners-2.getMaxListeners-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Max<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#getMaxListeners-2.getMaxListeners-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the currently set max amount of listeners.</p>
|
|
499
|
-
<p>For <code>EventEmitter</code>s this behaves exactly the same as calling <code>.getMaxListeners</code> on
|
|
500
|
-
the emitter.</p>
|
|
501
|
-
<p>For <code>EventTarget</code>s this is the only way to get the max event listeners for the
|
|
502
|
-
event target. If the number of event handlers on a single EventTarget exceeds
|
|
503
|
-
the max set, the EventTarget will print a warning.</p>
|
|
504
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">getMaxListeners</span><span class="hl-1">, </span><span class="hl-7">setMaxListeners</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getMaxListeners</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">)); </span><span class="hl-5">// 10</span><br/><span class="hl-1"> </span><span class="hl-0">setMaxListeners</span><span class="hl-1">(</span><span class="hl-9">11</span><span class="hl-1">, </span><span class="hl-7">ee</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getMaxListeners</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">)); </span><span class="hl-5">// 11</span><br/><span class="hl-1">}</span><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">et</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventTarget</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getMaxListeners</span><span class="hl-1">(</span><span class="hl-7">et</span><span class="hl-1">)); </span><span class="hl-5">// 10</span><br/><span class="hl-1"> </span><span class="hl-0">setMaxListeners</span><span class="hl-1">(</span><span class="hl-9">11</span><span class="hl-1">, </span><span class="hl-7">et</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">getMaxListeners</span><span class="hl-1">(</span><span class="hl-7">et</span><span class="hl-1">)); </span><span class="hl-5">// 11</span><br/><span class="hl-1">}</span>
|
|
505
|
-
</code><button>Copy</button></pre>
|
|
506
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventTarget</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v19.9.0</p>
|
|
507
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#getMaxListeners-2">getMaxListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:365</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="isDisturbed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>is<wbr/>Disturbed</span><a href="#isDisturbed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="isDisturbed.isDisturbed-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Disturbed</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">stream</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#isDisturbed.isDisturbed-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns whether the stream has been read from or cancelled.</p>
|
|
508
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">stream</span>: <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/_internal_.ReadableStream-1.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v16.8.0</p>
|
|
509
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#isDisturbed">isDisturbed</a></p><ul><li>Defined in node_modules/@types/node/stream.d.ts:65</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="listenerCount-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span class="deprecated">listener<wbr/>Count</span><a href="#listenerCount-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="listenerCount-2.listenerCount-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listener<wbr/>Count</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">eventName</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#listenerCount-2.listenerCount-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>A class method that returns the number of listeners for the given <code>eventName</code> registered on the given <code>emitter</code>.</p>
|
|
510
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1">, </span><span class="hl-7">listenerCount</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">myEmitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {});</span><br/><span class="hl-7">myEmitter</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-2">'event'</span><span class="hl-1">, () </span><span class="hl-3">=></span><span class="hl-1"> {});</span><br/><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-0">listenerCount</span><span class="hl-1">(</span><span class="hl-7">myEmitter</span><span class="hl-1">, </span><span class="hl-2">'event'</span><span class="hl-1">));</span><br/><span class="hl-5">// Prints: 2</span>
|
|
511
|
-
</code><button>Copy</button></pre>
|
|
512
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The emitter to query</p>
|
|
513
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The event name</p>
|
|
514
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v0.9.12</p>
|
|
515
|
-
<h4>Deprecated</h4><p>Since v3.2.0 - Use <code>listenerCount</code> instead.</p>
|
|
516
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#listenerCount-2">listenerCount</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:308</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="on-9" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>on</span><a href="#on-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="on-9.on-10" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#on-9.on-10" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">on</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-6">import</span><span class="hl-1"> </span><span class="hl-7">process</span><span class="hl-1"> </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:process'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-5">// Emit later on</span><br/><span class="hl-7">process</span><span class="hl-1">.</span><span class="hl-0">nextTick</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-2">'bar'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-9">42</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">for</span><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> (</span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">event</span><span class="hl-1"> </span><span class="hl-3">of</span><span class="hl-1"> </span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'foo'</span><span class="hl-1">)) {</span><br/><span class="hl-1"> </span><span class="hl-5">// The execution of this inner block is synchronous and it</span><br/><span class="hl-1"> </span><span class="hl-5">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-1"> </span><span class="hl-5">// if concurrent execution is required.</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">event</span><span class="hl-1">); </span><span class="hl-5">// prints ['bar'] [42]</span><br/><span class="hl-1">}</span><br/><span class="hl-5">// Unreachable here</span>
|
|
517
|
-
</code><button>Copy</button></pre>
|
|
518
|
-
<p>Returns an <code>AsyncIterator</code> that iterates <code>eventName</code> events. It will throw
|
|
519
|
-
if the <code>EventEmitter</code> emits <code>'error'</code>. It removes all listeners when
|
|
520
|
-
exiting the loop. The <code>value</code> returned by each iteration is an array
|
|
521
|
-
composed of the emitted event arguments.</p>
|
|
522
|
-
<p>An <code>AbortSignal</code> can be used to cancel waiting on events:</p>
|
|
523
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">on</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-6">import</span><span class="hl-1"> </span><span class="hl-7">process</span><span class="hl-1"> </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:process'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ac</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AbortController</span><span class="hl-1">();</span><br/><br/><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-1"> </span><span class="hl-5">// Emit later on</span><br/><span class="hl-1"> </span><span class="hl-7">process</span><span class="hl-1">.</span><span class="hl-0">nextTick</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-2">'bar'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-9">42</span><span class="hl-1">);</span><br/><span class="hl-1"> });</span><br/><br/><span class="hl-1"> </span><span class="hl-6">for</span><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> (</span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">event</span><span class="hl-1"> </span><span class="hl-3">of</span><span class="hl-1"> </span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'foo'</span><span class="hl-1">, { </span><span class="hl-7">signal:</span><span class="hl-1"> </span><span class="hl-7">ac</span><span class="hl-1">.</span><span class="hl-7">signal</span><span class="hl-1"> })) {</span><br/><span class="hl-1"> </span><span class="hl-5">// The execution of this inner block is synchronous and it</span><br/><span class="hl-1"> </span><span class="hl-5">// processes one event at a time (even with await). Do not use</span><br/><span class="hl-1"> </span><span class="hl-5">// if concurrent execution is required.</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">event</span><span class="hl-1">); </span><span class="hl-5">// prints ['bar'] [42]</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">// Unreachable here</span><br/><span class="hl-1">})();</span><br/><br/><span class="hl-7">process</span><span class="hl-1">.</span><span class="hl-0">nextTick</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">ac</span><span class="hl-1">.</span><span class="hl-0">abort</span><span class="hl-1">());</span>
|
|
524
|
-
</code><button>Copy</button></pre>
|
|
525
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>The name of the event being listened for</p>
|
|
526
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.StaticEventEmitterOptions.html" class="tsd-signature-type tsd-kind-interface">StaticEventEmitterOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><p>An <code>AsyncIterator</code> that iterates <code>eventName</code> events emitted by the <code>emitter</code></p>
|
|
527
|
-
<div class="tsd-comment tsd-typography"><h4>Since</h4><p>v13.6.0, v12.16.0</p>
|
|
528
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on-9">on</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:281</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="on-9.on-11" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#on-9.on-11" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.StaticEventEmitterOptions.html" class="tsd-signature-type tsd-kind-interface">StaticEventEmitterOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.AsyncIterableIterator.html" class="tsd-signature-type tsd-kind-interface">AsyncIterableIterator</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#on-9">on</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:286</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="once-9" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>once</span><a href="#once-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="once-9.once-10" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#once-9.once-10" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a <code>Promise</code> that is fulfilled when the <code>EventEmitter</code> emits the given
|
|
529
|
-
event or that is rejected if the <code>EventEmitter</code> emits <code>'error'</code> while waiting.
|
|
530
|
-
The <code>Promise</code> will resolve with an array of all the arguments emitted to the
|
|
531
|
-
given event.</p>
|
|
532
|
-
<p>This method is intentionally generic and works with the web platform <a href="https://dom.spec.whatwg.org/#interface-eventtarget">EventTarget</a> interface, which has no special<code>'error'</code> event
|
|
533
|
-
semantics and does not listen to the <code>'error'</code> event.</p>
|
|
534
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">once</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><span class="hl-6">import</span><span class="hl-1"> </span><span class="hl-7">process</span><span class="hl-1"> </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:process'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-7">process</span><span class="hl-1">.</span><span class="hl-0">nextTick</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'myevent'</span><span class="hl-1">, </span><span class="hl-9">42</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> [</span><span class="hl-4">value</span><span class="hl-1">] = </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'myevent'</span><span class="hl-1">);</span><br/><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-7">value</span><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">err</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">'kaboom'</span><span class="hl-1">);</span><br/><span class="hl-7">process</span><span class="hl-1">.</span><span class="hl-0">nextTick</span><span class="hl-1">(() </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'error'</span><span class="hl-1">, </span><span class="hl-7">err</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'myevent'</span><span class="hl-1">);</span><br/><span class="hl-1">} </span><span class="hl-6">catch</span><span class="hl-1"> (</span><span class="hl-7">err</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">'error happened'</span><span class="hl-1">, </span><span class="hl-7">err</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
|
535
|
-
</code><button>Copy</button></pre>
|
|
536
|
-
<p>The special handling of the <code>'error'</code> event is only used when <code>events.once()</code> is used to wait for another event. If <code>events.once()</code> is used to wait for the
|
|
537
|
-
'<code>error'</code> event itself, then it is treated as any other kind of event without
|
|
538
|
-
special handling:</p>
|
|
539
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1">, </span><span class="hl-7">once</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'error'</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">then</span><span class="hl-1">(([</span><span class="hl-7">err</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'ok'</span><span class="hl-1">, </span><span class="hl-7">err</span><span class="hl-1">.</span><span class="hl-7">message</span><span class="hl-1">))</span><br/><span class="hl-1"> .</span><span class="hl-0">catch</span><span class="hl-1">((</span><span class="hl-7">err</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">'error'</span><span class="hl-1">, </span><span class="hl-7">err</span><span class="hl-1">.</span><span class="hl-7">message</span><span class="hl-1">));</span><br/><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'error'</span><span class="hl-1">, </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">'boom'</span><span class="hl-1">));</span><br/><br/><span class="hl-5">// Prints: ok boom</span>
|
|
540
|
-
</code><button>Copy</button></pre>
|
|
541
|
-
<p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p>
|
|
542
|
-
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">EventEmitter</span><span class="hl-1">, </span><span class="hl-7">once</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ee</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">ac</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">AbortController</span><span class="hl-1">();</span><br/><br/><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">foo</span><span class="hl-1">(</span><span class="hl-7">emitter</span><span class="hl-1">, </span><span class="hl-7">event</span><span class="hl-1">, </span><span class="hl-7">signal</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-6">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">once</span><span class="hl-1">(</span><span class="hl-7">emitter</span><span class="hl-1">, </span><span class="hl-7">event</span><span class="hl-1">, { </span><span class="hl-7">signal</span><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'event emitted!'</span><span class="hl-1">);</span><br/><span class="hl-1"> } </span><span class="hl-6">catch</span><span class="hl-1"> (</span><span class="hl-7">error</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-6">if</span><span class="hl-1"> (</span><span class="hl-7">error</span><span class="hl-1">.</span><span class="hl-7">name</span><span class="hl-1"> === </span><span class="hl-2">'AbortError'</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">'Waiting for the event was canceled!'</span><span class="hl-1">);</span><br/><span class="hl-1"> } </span><span class="hl-6">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">'There was an error'</span><span class="hl-1">, </span><span class="hl-7">error</span><span class="hl-1">.</span><span class="hl-7">message</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-0">foo</span><span class="hl-1">(</span><span class="hl-7">ee</span><span class="hl-1">, </span><span class="hl-2">'foo'</span><span class="hl-1">, </span><span class="hl-7">ac</span><span class="hl-1">.</span><span class="hl-7">signal</span><span class="hl-1">);</span><br/><span class="hl-7">ac</span><span class="hl-1">.</span><span class="hl-0">abort</span><span class="hl-1">(); </span><span class="hl-5">// Abort waiting for the event</span><br/><span class="hl-7">ee</span><span class="hl-1">.</span><span class="hl-0">emit</span><span class="hl-1">(</span><span class="hl-2">'foo'</span><span class="hl-1">); </span><span class="hl-5">// Prints: Waiting for the event was canceled!</span>
|
|
543
|
-
</code><button>Copy</button></pre>
|
|
544
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../types/_internal_.Pick.html" class="tsd-signature-type tsd-kind-type-alias">Pick</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_internal_.StaticEventEmitterOptions.html" class="tsd-signature-type tsd-kind-interface">StaticEventEmitterOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"signal"</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v11.13.0, v10.16.0</p>
|
|
545
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once-9">once</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:216</li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="once-9.once-11" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">emitter</span>, <span class="tsd-kind-parameter">eventName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#once-9.once-11" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">emitter</span>: <span class="tsd-signature-type">EventTarget</span></span></li><li><span><span class="tsd-kind-parameter">eventName</span>: <span class="tsd-signature-type">string</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/_internal_.StaticEventEmitterOptions.html" class="tsd-signature-type tsd-kind-interface">StaticEventEmitterOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#once-9">once</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:221</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><a id="setMaxListeners-2" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>set<wbr/>Max<wbr/>Listeners</span><a href="#setMaxListeners-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="setMaxListeners-2.setMaxListeners-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Max<wbr/>Listeners</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">n</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">eventTargets</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#setMaxListeners-2.setMaxListeners-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><pre><code class="language-js"><span class="hl-6">import</span><span class="hl-1"> { </span><span class="hl-7">setMaxListeners</span><span class="hl-1">, </span><span class="hl-7">EventEmitter</span><span class="hl-1"> } </span><span class="hl-6">from</span><span class="hl-1"> </span><span class="hl-2">'node:events'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">target</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventTarget</span><span class="hl-1">();</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-4">emitter</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">EventEmitter</span><span class="hl-1">();</span><br/><br/><span class="hl-0">setMaxListeners</span><span class="hl-1">(</span><span class="hl-9">5</span><span class="hl-1">, </span><span class="hl-7">target</span><span class="hl-1">, </span><span class="hl-7">emitter</span><span class="hl-1">);</span>
|
|
546
|
-
</code><button>Copy</button></pre>
|
|
547
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">n</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p>
|
|
548
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">eventTargets</span>: <span class="tsd-signature-symbol">(</span><a href="../interfaces/_internal_.EventEmitter-2.html" class="tsd-signature-type tsd-kind-interface">EventEmitter</a><span class="tsd-signature-symbol"><</span><a href="../types/_internal_.DefaultEventMap.html" class="tsd-signature-type tsd-kind-type-alias">DefaultEventMap</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v15.4.0</p>
|
|
549
|
-
</div><aside class="tsd-sources"><p>Inherited from <a href="_internal_.ReadableBase.html">ReadableBase</a>.<a href="_internal_.ReadableBase.html#setMaxListeners-2">setMaxListeners</a></p><ul><li>Defined in node_modules/@types/node/events.d.ts:380</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-external"><a id="toWeb" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>to<wbr/>Web</span><a href="#toWeb" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-external"><li class="tsd-signature tsd-anchor-link"><a id="toWeb.toWeb-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">to<wbr/>Web</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">streamReadable</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_internal_.ReadableStream.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#toWeb.toWeb-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><code class="tsd-tag ts-flagExperimental">Experimental</code> <div class="tsd-comment tsd-typography"><p>A utility method for creating a web <code>ReadableStream</code> from a <code>Readable</code>.</p>
|
|
550
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">streamReadable</span>: <a href="_internal_.Readable.html" class="tsd-signature-type tsd-kind-class">Readable</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_internal_.ReadableStream.html" class="tsd-signature-type tsd-kind-interface">ReadableStream</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4>Since</h4><p>v17.0.0</p>
|
|
551
|
-
</div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/stream.d.ts:984</li></ul></aside></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#constructor" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a><a href="#closed" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>closed</span></a><a href="#destroyed" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>destroyed</span></a><a href="#errored" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>errored</span></a><a href="#readable" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable</span></a><a href="#readableAborted" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Aborted</span></a><a href="#readableDidRead" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Did<wbr/>Read</span></a><a href="#readableEncoding" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Encoding</span></a><a href="#readableEnded" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Ended</span></a><a href="#readableFlowing" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Flowing</span></a><a href="#readableHighWaterMark" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>High<wbr/>Water<wbr/>Mark</span></a><a href="#readableLength" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Length</span></a><a href="#readableObjectMode" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>readable<wbr/>Object<wbr/>Mode</span></a><a href="#captureRejectionSymbol" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejection<wbr/>Symbol</span></a><a href="#captureRejections" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>capture<wbr/>Rejections</span></a><a href="#defaultMaxListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>default<wbr/>Max<wbr/>Listeners</span></a><a href="#errorMonitor" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>error<wbr/>Monitor</span></a><a href="#_asyncDispose_" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[async<wbr/>Dispose]</span></a><a href="#_asyncIterator_" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[async<wbr/>Iterator]</span></a><a href="#_captureRejectionSymbol_" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>[capture<wbr/>Rejection<wbr/>Symbol]</span></a><a href="#_construct" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_construct</span></a><a href="#_destroy" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_destroy</span></a><a href="#_read" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_read</span></a><a href="#addListener" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Listener</span></a><a href="#asIndexedPairs" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>as<wbr/>Indexed<wbr/>Pairs</span></a><a href="#compose" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>compose</span></a><a href="#destroy" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>destroy</span></a><a href="#drop" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop</span></a><a href="#emit" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a><a href="#eventNames" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>event<wbr/>Names</span></a><a href="#every" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>every</span></a><a href="#filter" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>filter</span></a><a href="#find" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find</span></a><a href="#flatMap" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>flat<wbr/>Map</span></a><a href="#forEach" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>for<wbr/>Each</span></a><a href="#getMaxListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a><a href="#isPaused" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Paused</span></a><a href="#iterator" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>iterator</span></a><a href="#listenerCount" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a><a href="#listeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listeners</span></a><a href="#map" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>map</span></a><a href="#off" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a><a href="#on" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a><a href="#once" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a><a href="#pause" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>pause</span></a><a href="#pipe" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>pipe</span></a><a href="#prependListener" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Listener</span></a><a href="#prependOnceListener" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>prepend<wbr/>Once<wbr/>Listener</span></a><a href="#push" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>push</span></a><a href="#rawListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>raw<wbr/>Listeners</span></a><a href="#read" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read</span></a><a href="#reduce" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>reduce</span></a><a href="#removeAllListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>All<wbr/>Listeners</span></a><a href="#removeListener" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Listener</span></a><a href="#resume" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>resume</span></a><a href="#setEncoding" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Encoding</span></a><a href="#setMaxListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a><a href="#some" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>some</span></a><a href="#take" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>take</span></a><a href="#toArray" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Array</span></a><a href="#unpipe" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unpipe</span></a><a href="#unshift" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unshift</span></a><a href="#wrap" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wrap</span></a><a href="#addAbortListener" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Abort<wbr/>Listener</span></a><a href="#from" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>from</span></a><a href="#fromWeb" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>from<wbr/>Web</span></a><a href="#getEventListeners" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Event<wbr/>Listeners</span></a><a href="#getMaxListeners-2" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Max<wbr/>Listeners</span></a><a href="#isDisturbed" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Disturbed</span></a><a href="#listenerCount-2" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>listener<wbr/>Count</span></a><a href="#on-9" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a><a href="#once-9" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a><a href="#setMaxListeners-2" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Max<wbr/>Listeners</span></a><a href="#toWeb" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Web</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@codebolt/codeboltjs</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|