Sends the final data chunk and initiates a graceful shutdown of the socket's write side. After calling end(), no more data can be written using write() or end(). The socket remains readable until the remote end also closes its write side or the connection is terminated. This sends a TCP FIN packet after writing the data.
TCPSocket.end method | Bun module | Bun BuildDocsReferenceGuidesBlogDiscord/Bun/TCPSocket/endMend BuildDocsReferenceGuidesBlogDiscord /Bun/TCPSocket/endMend TCPSocket.endend(data?: string | BufferSource,byteOffset?: number,byteLength?: number): number; @param data @param byteOffset @param byteLength @returns end(): void; Referenced typestype BufferSource = NodeJS.TypedArrayArrayBufferLike> | DataViewArrayBufferLike> | ArrayBufferLike
Search the reference...
/
method
Optional final data to write before closing. Same types as write().
Optional offset for buffer data.
Optional length for buffer data.
The number of bytes written for the final chunk. Returns -1 if the socket was already closed or shutting down.
// send some data and close the write side
socket.end("Goodbye!");
// or close write side without sending final data
socket.end();
Close the socket immediately
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →TCPSocket.end method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引
- API documentation for method bun.TCPSocket.end | Bun