write

open override fun write(buffer: Uint8Array, cb: (JsError?) -> Unit): Boolean(source)
open override fun write(buffer: String, cb: (JsError?) -> Unit): Boolean(source)

Sends data on the socket. The second parameter specifies the encoding in the case of a string. It defaults to UTF8 encoding.

Returns true if the entire data was flushed successfully to the kernel buffer. Returns false if all or part of the data was queued in user memory.'drain' will be emitted when the buffer is again free.

The optional callback parameter will be executed when the data is finally written out, which may not be immediately.

See Writable stream write() method for more information.

Since

v0.1.90

Parameters

encoding='utf8' Only used when data is string.


fun write(str: Uint8Array, encoding: BufferEncoding = definedExternally, cb: (JsError?) -> Unit = definedExternally): Boolean(source)
open override fun write(str: String, encoding: BufferEncoding, cb: (JsError?) -> Unit): Boolean(source)