BufferAPI

interface BufferAPI : NodeAPI

Node API: Buffer

Defines the types and members of the Node.js buffer built-in module.

See also

Types

Link copied to clipboard

Implements the Blob type from the Node.js buffer built-in module. Blobs are read-only chunks of byte data which can be used to derive buffers, strings, and other objects.

Link copied to clipboard

Implements the File class from the Node.js buffer built-in module. This type is basically a specialized Blob with additional name and lastModified fields.

Functions

Link copied to clipboard
abstract fun atob(data: Value): String

Decodes a string of Base64-encoded data into bytes, and encodes those bytes into a string using Latin-1.

Link copied to clipboard
abstract fun btoa(data: Value): String

Decodes a string into bytes using Latin01, end encodes those bytes into a string using Base64.

Link copied to clipboard
abstract fun isAscii(input: Value): Boolean

Returns whether the provided input contains only valid ASCII-encoded data, or is empty.

Link copied to clipboard
abstract fun isUtf8(input: Value): Boolean

Returns whether the provided input contains only valid UTF-8-encoded data, or is empty.

Link copied to clipboard
abstract fun resolveObjectUrl(id: String): Value

Resolves a 'blob:nodedata:...' an associated Blob object registered using a prior call to URL.createObjectURL().

Link copied to clipboard
abstract fun transcode(source: Value, fromEnc: String, toEnc: String): Value

Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. Returns a new Buffer instance. Supported encodings are 'ascii', 'utf8, 'utf16le', 'ucs2', 'latin1', 'binary'.