Constructors

Link copied to clipboard
constructor(str: String, encoding: BufferEncoding = definedExternally)
constructor(size: Number)
constructor(array: ArrayLike<Double>)
constructor(arrayBuffer: TArrayBuffer)

Types

Link copied to clipboard
external object Companion

Properties

Link copied to clipboard
open external override val buffer: TArrayBuffer
Link copied to clipboard
open external override val byteLength: Int
Link copied to clipboard
open external override val byteOffset: Int
Link copied to clipboard
external val BYTES_PER_ELEMENT: Int
Link copied to clipboard
open external override val length: Int

Functions

Link copied to clipboard
open external fun [@@iterator](): JsIterator<JsUByte>
Link copied to clipboard
external fun at(index: Int): JsUByte?
Link copied to clipboard
external fun compare(target: Uint8Array<*>, targetStart: Number = definedExternally, targetEnd: Number = definedExternally, sourceStart: Number = definedExternally, sourceEnd: Number = definedExternally): Int

Compares buf with target and returns a number indicating whether bufcomes before, after, or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer.

Link copied to clipboard
external fun copy(target: Uint8Array<*>, targetStart: Number = definedExternally, sourceStart: Number = definedExternally, sourceEnd: Number = definedExternally): Double

Copies data from a region of buf to a region in target, even if the targetmemory region overlaps with buf.

Link copied to clipboard
external fun copyWithin(target: Int, start: Int, end: Int): Uint8Array<TArrayBuffer>
Link copied to clipboard
open external fun entries(): JsIterator<Tuple2<JsInt, JsUByte>>
Link copied to clipboard
external fun equals(otherBuffer: Uint8Array<*>): Boolean

Returns true if both buf and otherBuffer have exactly the same bytes,false otherwise. Equivalent to buf.compare(otherBuffer) === 0.

Link copied to clipboard
external fun every(predicate: (JsUByte) -> Boolean): Boolean
Link copied to clipboard
external fun fill(value: JsUByte, start: Int, end: Int): Uint8Array<TArrayBuffer>
external fun fill(value: Uint8Array<*>, encoding: BufferEncoding)
external fun fill(value: Double, encoding: BufferEncoding)
external fun fill(value: String, encoding: BufferEncoding)
external fun fill(value: Uint8Array<*>, offset: Number, encoding: BufferEncoding)
external fun fill(value: Double, offset: Number, encoding: BufferEncoding)
external fun fill(value: String, offset: Number, encoding: BufferEncoding)

external fun fill(value: Uint8Array<*>, offset: Number = definedExternally, end: Number = definedExternally, encoding: BufferEncoding = definedExternally)
external fun fill(value: Double, offset: Number = definedExternally, end: Number = definedExternally, encoding: BufferEncoding = definedExternally)
external fun fill(value: String, offset: Number = definedExternally, end: Number = definedExternally, encoding: BufferEncoding = definedExternally)

Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled:

Link copied to clipboard
external fun filter(predicate: (JsUByte) -> Boolean): Uint8Array<ArrayBuffer>
Link copied to clipboard
external fun find(predicate: (JsUByte) -> Boolean): JsUByte?
Link copied to clipboard
external fun findIndex(predicate: (JsUByte) -> Boolean): Int
Link copied to clipboard
external fun findLast(predicate: (JsUByte) -> Boolean): JsUByte?
Link copied to clipboard
external fun findLastIndex(predicate: (JsUByte) -> Boolean): Int
Link copied to clipboard
open external override fun forEach(action: (JsUByte) -> Unit)
Link copied to clipboard
open operator external fun get(index: Int): JsUByte
Link copied to clipboard
external fun includes(searchElement: JsUByte, fromIndex: Int): Boolean
external fun includes(value: Double, encoding: BufferEncoding): Boolean
external fun includes(value: String, encoding: BufferEncoding): Boolean
external fun includes(value: Buffer<*>, encoding: BufferEncoding): Boolean

external fun includes(value: Double, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Boolean
external fun includes(value: String, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Boolean
external fun includes(value: Buffer<*>, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Boolean

Equivalent to buf.indexOf() !== -1.

Link copied to clipboard
external fun indexOf(searchElement: JsUByte, fromIndex: Int): Int
external fun indexOf(value: Uint8Array<*>, encoding: BufferEncoding): Double
external fun indexOf(value: Double, encoding: BufferEncoding): Double
external fun indexOf(value: String, encoding: BufferEncoding): Double

external fun indexOf(value: Uint8Array<*>, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double
external fun indexOf(value: Double, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double
external fun indexOf(value: String, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double

If value is:

Link copied to clipboard
external fun join(separator: String): String
Link copied to clipboard
open external fun keys(): JsIterator<JsInt>
Link copied to clipboard
external fun lastIndexOf(searchElement: JsUByte, fromIndex: Int): Int
external fun lastIndexOf(value: Uint8Array<*>, encoding: BufferEncoding): Double
external fun lastIndexOf(value: Double, encoding: BufferEncoding): Double
external fun lastIndexOf(value: String, encoding: BufferEncoding): Double

external fun lastIndexOf(value: Uint8Array<*>, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double
external fun lastIndexOf(value: Double, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double
external fun lastIndexOf(value: String, byteOffset: Number = definedExternally, encoding: BufferEncoding = definedExternally): Double

Identical to buf.indexOf(), except the last occurrence of value is found rather than the first occurrence.

Link copied to clipboard
external fun map(transform: (JsUByte) -> JsUByte): Uint8Array<ArrayBuffer>
Link copied to clipboard
external fun readBigInt64BE(offset: Number = definedExternally): BigInt

Reads a signed, big-endian 64-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readBigInt64LE(offset: Number = definedExternally): BigInt

Reads a signed, little-endian 64-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readBigUInt64BE(offset: Number = definedExternally): BigInt

Reads an unsigned, big-endian 64-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readBigUint64BE(offset: Number = definedExternally): BigInt
Link copied to clipboard
external fun readBigUInt64LE(offset: Number = definedExternally): BigInt

Reads an unsigned, little-endian 64-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readBigUint64LE(offset: Number = definedExternally): BigInt
Link copied to clipboard
external fun readDoubleBE(offset: Number = definedExternally): Double

Reads a 64-bit, big-endian double from buf at the specified offset.

Link copied to clipboard
external fun readDoubleLE(offset: Number = definedExternally): Double

Reads a 64-bit, little-endian double from buf at the specified offset.

Link copied to clipboard
external fun readFloatBE(offset: Number = definedExternally): Double

Reads a 32-bit, big-endian float from buf at the specified offset.

Link copied to clipboard
external fun readFloatLE(offset: Number = definedExternally): Double

Reads a 32-bit, little-endian float from buf at the specified offset.

Link copied to clipboard
external fun readInt16BE(offset: Number = definedExternally): Double

Reads a signed, big-endian 16-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readInt16LE(offset: Number = definedExternally): Double

Reads a signed, little-endian 16-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readInt32BE(offset: Number = definedExternally): Double

Reads a signed, big-endian 32-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readInt32LE(offset: Number = definedExternally): Double

Reads a signed, little-endian 32-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readInt8(offset: Number = definedExternally): Double

Reads a signed 8-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readIntBE(offset: Number, byteLength: Number): Double

Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, two's complement signed value supporting up to 48 bits of accuracy.

Link copied to clipboard
external fun readIntLE(offset: Number, byteLength: Number): Double

Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, two's complement signed value supporting up to 48 bits of accuracy.

Link copied to clipboard
external fun readUInt16BE(offset: Number = definedExternally): Double

Reads an unsigned, big-endian 16-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readUint16BE(offset: Number = definedExternally): Double
Link copied to clipboard
external fun readUInt16LE(offset: Number = definedExternally): Double

Reads an unsigned, little-endian 16-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readUint16LE(offset: Number = definedExternally): Double
Link copied to clipboard
external fun readUInt32BE(offset: Number = definedExternally): Double

Reads an unsigned, big-endian 32-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readUint32BE(offset: Number = definedExternally): Double
Link copied to clipboard
external fun readUInt32LE(offset: Number = definedExternally): Double

Reads an unsigned, little-endian 32-bit integer from buf at the specifiedoffset.

Link copied to clipboard
external fun readUint32LE(offset: Number = definedExternally): Double
Link copied to clipboard
external fun readUInt8(offset: Number = definedExternally): Double

Reads an unsigned 8-bit integer from buf at the specified offset.

Link copied to clipboard
external fun readUint8(offset: Number = definedExternally): Double
Link copied to clipboard
external fun readUIntBE(offset: Number, byteLength: Number): Double

Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned big-endian integer supporting up to 48 bits of accuracy.

Link copied to clipboard
external fun readUintBE(offset: Number, byteLength: Number): Double
Link copied to clipboard
external fun readUIntLE(offset: Number, byteLength: Number): Double

Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, little-endian integer supporting up to 48 bits of accuracy.

Link copied to clipboard
external fun readUintLE(offset: Number, byteLength: Number): Double
Link copied to clipboard
external fun reduce(operation: (JsUByte, JsUByte, currentIndex: Int) -> JsUByte): JsUByte
external fun <U> reduce(operation: (previousValue: U, JsUByte, currentIndex: Int) -> U, initialValue: U): U
Link copied to clipboard
external fun reduceRight(operation: (JsUByte, JsUByte, currentIndex: Int) -> JsUByte): JsUByte
external fun <U> reduceRight(operation: (previousValue: U, JsUByte, currentIndex: Int) -> U, initialValue: U): U
Link copied to clipboard
Link copied to clipboard
open operator external fun set(index: Int, value: JsUByte)
external fun set(array: ArrayLike<JsUByte>, offset: Int)
external fun set(array: ReadonlyArray<JsUByte>, offset: Int)
Link copied to clipboard
external fun setFromBase64(string: String, options: FromBase64Options): SetFromResult
Link copied to clipboard
external fun setFromHex(string: String): SetFromResult
Link copied to clipboard
external fun slice(start: Int, end: Int): Uint8Array<ArrayBuffer>

external fun slice(start: Number = definedExternally, end: Number = definedExternally): Buffer<ArrayBuffer>

Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.

Link copied to clipboard
external fun some(predicate: (JsUByte) -> Boolean): Boolean
Link copied to clipboard
external fun sort(comparison: (JsUByte, JsUByte) -> Int): Uint8Array<TArrayBuffer>
Link copied to clipboard
external fun subarray(start: Int, end: Int): Uint8Array<TArrayBuffer>

external fun subarray(start: Number = definedExternally, end: Number = definedExternally): Buffer<TArrayBuffer>

Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.

Link copied to clipboard
external fun swap16()

Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 2.

Link copied to clipboard
external fun swap32()

Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 4.

Link copied to clipboard
external fun swap64()

Interprets buf as an array of 64-bit numbers and swaps byte order in-place. Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 8.

Link copied to clipboard
external fun toBase64(options: ToBase64Options): String
Link copied to clipboard
external fun toHex(): String
Link copied to clipboard
external fun toJSON(): BufferToJSONResult

Returns a JSON representation of buf. JSON.stringify() implicitly calls this function when stringifying a Buffer instance.

Link copied to clipboard
external fun toLocaleString(): String
Link copied to clipboard
Link copied to clipboard
external fun toSorted(comparison: (JsUByte, JsUByte) -> Int): Uint8Array<ArrayBuffer>
Link copied to clipboard
external fun toString(encoding: BufferEncoding = definedExternally, start: Number = definedExternally, end: Number = definedExternally): String

Decodes buf to a string according to the specified character encoding inencoding. start and end may be passed to decode only a subset of buf.

Link copied to clipboard
Link copied to clipboard
open external fun values(): JsIterator<JsUByte>
Link copied to clipboard
external fun with(index: Int, value: JsUByte): Uint8Array<ArrayBuffer>
Link copied to clipboard
external fun write(string: String, encoding: BufferEncoding = definedExternally): Double

Writes string to buf at offset according to the character encoding inencoding. The length parameter is the number of bytes to write. If buf did not contain enough space to fit the entire string, only part of string will be written. However, partially encoded characters will not be written.

external fun write(string: String, offset: Number, encoding: BufferEncoding = definedExternally): Double
external fun write(string: String, offset: Number, length: Number, encoding: BufferEncoding = definedExternally): Double
Link copied to clipboard
external fun writeBigInt64BE(value: BigInt, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian.

Link copied to clipboard
external fun writeBigInt64LE(value: BigInt, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian.

Link copied to clipboard
external fun writeBigUInt64BE(value: BigInt, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian.

Link copied to clipboard
external fun writeBigUint64BE(value: BigInt, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeBigUInt64LE(value: BigInt, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian

Link copied to clipboard
external fun writeBigUint64LE(value: BigInt, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeDoubleBE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. The value must be a JavaScript number. Behavior is undefined when value is anything other than a JavaScript number.

Link copied to clipboard
external fun writeDoubleLE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. The value must be a JavaScript number. Behavior is undefined when value is anything other than a JavaScript number.

Link copied to clipboard
external fun writeFloatBE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. Behavior is undefined when value is anything other than a JavaScript number.

Link copied to clipboard
external fun writeFloatLE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. Behavior is undefined when value is anything other than a JavaScript number.

Link copied to clipboard
external fun writeInt16BE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer. Behavior is undefined when value is anything other than a signed 16-bit integer.

Link copied to clipboard
external fun writeInt16LE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer. Behavior is undefined when value is anything other than a signed 16-bit integer.

Link copied to clipboard
external fun writeInt32BE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. Behavior is undefined when value is anything other than a signed 32-bit integer.

Link copied to clipboard
external fun writeInt32LE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. Behavior is undefined when value is anything other than a signed 32-bit integer.

Link copied to clipboard
external fun writeInt8(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. Behavior is undefined when value is anything other than a signed 8-bit integer.

Link copied to clipboard
external fun writeIntBE(value: Number, offset: Number, byteLength: Number): Double

Writes byteLength bytes of value to buf at the specified offsetas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined whenvalue is anything other than a signed integer.

Link copied to clipboard
external fun writeIntLE(value: Number, offset: Number, byteLength: Number): Double

Writes byteLength bytes of value to buf at the specified offsetas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than a signed integer.

Link copied to clipboard
external fun writeUInt16BE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. Behavior is undefined when valueis anything other than an unsigned 16-bit integer.

Link copied to clipboard
external fun writeUint16BE(value: Number, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeUInt16LE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. Behavior is undefined when value is anything other than an unsigned 16-bit integer.

Link copied to clipboard
external fun writeUint16LE(value: Number, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeUInt32BE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. Behavior is undefined when valueis anything other than an unsigned 32-bit integer.

Link copied to clipboard
external fun writeUint32BE(value: Number, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeUInt32LE(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. Behavior is undefined when value is anything other than an unsigned 32-bit integer.

Link copied to clipboard
external fun writeUint32LE(value: Number, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeUInt8(value: Number, offset: Number = definedExternally): Double

Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer. Behavior is undefined when value is anything other than an unsigned 8-bit integer.

Link copied to clipboard
external fun writeUint8(value: Number, offset: Number = definedExternally): Double
Link copied to clipboard
external fun writeUIntBE(value: Number, offset: Number, byteLength: Number): Double

Writes byteLength bytes of value to buf at the specified offsetas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than an unsigned integer.

Link copied to clipboard
external fun writeUintBE(value: Number, offset: Number, byteLength: Number): Double
Link copied to clipboard
external fun writeUIntLE(value: Number, offset: Number, byteLength: Number): Double

Writes byteLength bytes of value to buf at the specified offsetas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined when value is anything other than an unsigned integer.

Link copied to clipboard
external fun writeUintLE(value: Number, offset: Number, byteLength: Number): Double