Skip to content

Class: SerialBuffer

Extends

  • Uint8Array

Constructors

new SerialBuffer()

new SerialBuffer(length): SerialBuffer

Parameters

length: number

Returns

SerialBuffer

Overrides

Uint8Array.constructor

Defined in

@nimiq/core/lib/index.d.ts:10

new SerialBuffer()

new SerialBuffer(array): SerialBuffer

Parameters

array: ArrayBufferLike | ArrayLike<number>

Returns

SerialBuffer

Overrides

Uint8Array.constructor

Defined in

@nimiq/core/lib/index.d.ts:11

Properties

[toStringTag]

readonly [toStringTag]: "Uint8Array"

Inherited from

Uint8Array.[toStringTag]

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:284


buffer

readonly buffer: ArrayBufferLike

The ArrayBuffer instance referenced by the array.

Inherited from

Uint8Array.buffer

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2166


byteLength

readonly byteLength: number

The length in bytes of the array.

Inherited from

Uint8Array.byteLength

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2171


byteOffset

readonly byteOffset: number

The offset in bytes of the array.

Inherited from

Uint8Array.byteOffset

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2176


BYTES_PER_ELEMENT

readonly BYTES_PER_ELEMENT: number

The size in bytes of each element in the array.

Inherited from

Uint8Array.BYTES_PER_ELEMENT

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2161


length

readonly length: number

The length of the array.

Inherited from

Uint8Array.length

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2275


BYTES_PER_ELEMENT

readonly static BYTES_PER_ELEMENT: number

The size in bytes of each element in the array.

Inherited from

Uint8Array.BYTES_PER_ELEMENT

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2410


EMPTY

static EMPTY: SerialBuffer

Defined in

@nimiq/core/lib/index.d.ts:9

Accessors

readPos

get readPos(): number

set readPos(value): void

Parameters

value: number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:13


writePos

get writePos(): number

set writePos(value): void

Parameters

value: number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:15

Methods

[iterator]()

[iterator](): ArrayIterator<number>

Returns

ArrayIterator<number>

Inherited from

Uint8Array.[iterator]

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:302


at()

at(index): number

Parameters

index: number

Returns

number

Inherited from

Uint8Array.at

Defined in

.pnpm/@types+node@22.7.6/node_modules/@types/node/compatibility/indexable.d.ts:7


copyWithin()

copyWithin(target, start, end?): this

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Parameters

target: number

If target is negative, it is treated as length+target where length is the length of the array.

start: number

If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

end?: number

If not specified, length of the this object is used as its default value.

Returns

this

Inherited from

Uint8Array.copyWithin

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2187


entries()

entries(): ArrayIterator<[number, number]>

Returns an array of key, value pairs for every entry in the array

Returns

ArrayIterator<[number, number]>

Inherited from

Uint8Array.entries

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:306


every()

every(predicate, thisArg?): boolean

Determines whether all the members of an array satisfy the specified test.

Parameters

predicate

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg?: any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Uint8Array.every

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2197


fill()

fill(value, start?, end?): this

Changes all array elements from start to end index to a static value and returns the modified array

Parameters

value: number

value to fill array section with

start?: number

index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

end?: number

index to stop filling the array at. If end is negative, it is treated as length+end.

Returns

this

Inherited from

Uint8Array.fill

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2207


filter()

filter(predicate, thisArg?): Uint8Array

Returns the elements of an array that meet the condition specified in a callback function.

Parameters

predicate

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg?: any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

Uint8Array

Inherited from

Uint8Array.filter

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2216


find()

find(predicate, thisArg?): number

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Parameters

predicate

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

thisArg?: any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Uint8Array.find

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2227


findIndex()

findIndex(predicate, thisArg?): number

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Parameters

predicate

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

thisArg?: any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Uint8Array.findIndex

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2238


forEach()

forEach(callbackfn, thisArg?): void

Performs the specified action for each element in an array.

Parameters

callbackfn

A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

thisArg?: any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

void

Inherited from

Uint8Array.forEach

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2247


includes()

includes(searchElement, fromIndex?): boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

Parameters

searchElement: number

The element to search for.

fromIndex?: number

The position in this array at which to begin searching for searchElement.

Returns

boolean

Inherited from

Uint8Array.includes

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts:52


indexOf()

indexOf(searchElement, fromIndex?): number

Returns the index of the first occurrence of a value in an array.

Parameters

searchElement: number

The value to locate in the array.

fromIndex?: number

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Uint8Array.indexOf

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2255


join()

join(separator?): string

Adds all the elements of an array separated by the specified separator string.

Parameters

separator?: string

A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

Returns

string

Inherited from

Uint8Array.join

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2262


keys()

keys(): ArrayIterator<number>

Returns an list of keys in the array

Returns

ArrayIterator<number>

Inherited from

Uint8Array.keys

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:310


lastIndexOf()

lastIndexOf(searchElement, fromIndex?): number

Returns the index of the last occurrence of a value in an array.

Parameters

searchElement: number

The value to locate in the array.

fromIndex?: number

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Uint8Array.lastIndexOf

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2270


map()

map(callbackfn, thisArg?): Uint8Array

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Parameters

callbackfn

A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

thisArg?: any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

Uint8Array

Inherited from

Uint8Array.map

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2285


read()

read(length): Uint8Array

Parameters

length: number

Returns

Uint8Array

Defined in

@nimiq/core/lib/index.d.ts:21


readFloat64()

readFloat64(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:34


readPaddedString()

readPaddedString(length): string

Parameters

length: number

Returns

string

Defined in

@nimiq/core/lib/index.d.ts:38


readString()

readString(length): string

Parameters

length: number

Returns

string

Defined in

@nimiq/core/lib/index.d.ts:36


readUint16()

readUint16(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:25


readUint32()

readUint32(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:27


readUint64()

readUint64(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:29


readUint8()

readUint8(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:23


readVarLengthString()

readVarLengthString(): string

Returns

string

Defined in

@nimiq/core/lib/index.d.ts:40


readVarUint()

readVarUint(): number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:31


reduce()

reduce(callbackfn)

reduce(callbackfn): number

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters

callbackfn

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

Returns

number

Inherited from

Uint8Array.reduce

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2297

reduce(callbackfn, initialValue)

reduce(callbackfn, initialValue): number

Parameters

callbackfn

initialValue: number

Returns

number

Inherited from

Uint8Array.reduce

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2298

reduce(callbackfn, initialValue)

reduce<U>(callbackfn, initialValue): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters

U

Parameters

callbackfn

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

initialValue: U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Uint8Array.reduce

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2310


reduceRight()

reduceRight(callbackfn)

reduceRight(callbackfn): number

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters

callbackfn

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

Returns

number

Inherited from

Uint8Array.reduceRight

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2322

reduceRight(callbackfn, initialValue)

reduceRight(callbackfn, initialValue): number

Parameters

callbackfn

initialValue: number

Returns

number

Inherited from

Uint8Array.reduceRight

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2323

reduceRight(callbackfn, initialValue)

reduceRight<U>(callbackfn, initialValue): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters

U

Parameters

callbackfn

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue: U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Uint8Array.reduceRight

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2335


reset()

reset(): void

Resets the read and write position of the buffer to zero.

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:20


reverse()

reverse(): Uint8Array

Reverses the elements in an Array.

Returns

Uint8Array

Inherited from

Uint8Array.reverse

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2340


set()

set(array, offset?): void

Sets a value or an array of values.

Parameters

array: ArrayLike<number>

A typed or untyped array of values to set.

offset?: number

The index in the current array at which the values are to be written.

Returns

void

Inherited from

Uint8Array.set

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2347


slice()

slice(start?, end?): Uint8Array

Returns a section of an array.

Parameters

start?: number

The beginning of the specified portion of the array.

end?: number

The end of the specified portion of the array. This is exclusive of the element at the index 'end'.

Returns

Uint8Array

Inherited from

Uint8Array.slice

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2354


some()

some(predicate, thisArg?): boolean

Determines whether the specified callback function returns true for any element of an array.

Parameters

predicate

A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

thisArg?: any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Uint8Array.some

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2364


sort()

sort(compareFn?): this

Sorts an array.

Parameters

compareFn?

Function used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending order.

ts
[11,2,22,1].sort((a, b) => a - b)

Returns

this

Inherited from

Uint8Array.sort

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2375


subarray()

subarray(start?, end?): Uint8Array

Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.

Parameters

start?: number

end?: number

The index of the end of the array.

Returns

Uint8Array

Overrides

Uint8Array.subarray

Defined in

@nimiq/core/lib/index.d.ts:12


toLocaleString()

toLocaleString()

toLocaleString(): string

Converts a number to a string by using the current locale.

Returns

string

Inherited from

Uint8Array.toLocaleString

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2388

toLocaleString(locales, options)

toLocaleString(locales, options?): string

Parameters

locales: string | string[]

options?: NumberFormatOptions

Returns

string

Inherited from

Uint8Array.toLocaleString

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.core.d.ts:568


toString()

toString(): string

Returns a string representation of an array.

Returns

string

Inherited from

Uint8Array.toString

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2393


valueOf()

valueOf(): Uint8Array

Returns the primitive value of the specified object.

Returns

Uint8Array

Inherited from

Uint8Array.valueOf

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2396


values()

values(): ArrayIterator<number>

Returns an list of values in the array

Returns

ArrayIterator<number>

Inherited from

Uint8Array.values

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:314


write()

write(array): void

Parameters

array: Uint8Array

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:22


writeFloat64()

writeFloat64(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:35


writePaddedString()

writePaddedString(value, length): void

Parameters

value: string

length: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:39


writeString()

writeString(value, length): void

Parameters

value: string

length: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:37


writeUint16()

writeUint16(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:26


writeUint32()

writeUint32(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:28


writeUint64()

writeUint64(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:30


writeUint8()

writeUint8(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:24


writeVarLengthString()

writeVarLengthString(value): void

Parameters

value: string

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:41


writeVarUint()

writeVarUint(value): void

Parameters

value: number

Returns

void

Defined in

@nimiq/core/lib/index.d.ts:32


from()

from(arrayLike)

static from(arrayLike): Uint8Array

Creates an array from an array-like or iterable object.

Parameters

arrayLike: ArrayLike<number>

An array-like or iterable object to convert to an array.

Returns

Uint8Array

Inherited from

Uint8Array.from

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2422

from(arrayLike, mapfn, thisArg)

static from<T>(arrayLike, mapfn, thisArg?): Uint8Array

Creates an array from an array-like or iterable object.

Type Parameters

T

Parameters

arrayLike: ArrayLike<T>

An array-like or iterable object to convert to an array.

mapfn

A mapping function to call on every element of the array.

thisArg?: any

Value of 'this' used to invoke the mapfn.

Returns

Uint8Array

Inherited from

Uint8Array.from

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2430

from(arrayLike, mapfn, thisArg)

static from(arrayLike, mapfn?, thisArg?): Uint8Array

Creates an array from an array-like or iterable object.

Parameters

arrayLike: Iterable<number, any, any>

An array-like or iterable object to convert to an array.

mapfn?

A mapping function to call on every element of the array.

thisArg?: any

Value of 'this' used to invoke the mapfn.

Returns

Uint8Array

Inherited from

Uint8Array.from

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:326


of()

static of(...items): Uint8Array

Returns a new array from a set of elements.

Parameters

• ...items: number[]

A set of elements to include in the new array object.

Returns

Uint8Array

Inherited from

Uint8Array.of

Defined in

.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts:2416


varLengthStringSize()

static varLengthStringSize(value): number

Parameters

value: string

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:42


varUintSize()

static varUintSize(value): number

Parameters

value: number

Returns

number

Defined in

@nimiq/core/lib/index.d.ts:33