Uint8ArrayConstructor

Bun

Symbol

Uint8ArrayConstructor

interface Uint8ArrayConstructor

  • constructor (length: number): Uint8Array<ArrayBuffer>
    constructor (array: ArrayLike<number>): Uint8Array<ArrayBuffer>
    constructor <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): Uint8Array<TArrayBuffer>
    constructor (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array<ArrayBuffer>
    constructor (array: ArrayBuffer | ArrayLike<number>): Uint8Array<ArrayBuffer>
    constructor (elements: Iterable<number>): Uint8Array<ArrayBuffer>
    constructor (): Uint8Array<ArrayBuffer>
  • readonly BYTES_PER_ELEMENT: number

    The size in bytes of each element in the array.

  • readonly prototype: Uint8Array<ArrayBufferLike>
  • from(arrayLike: ArrayLike<number>): Uint8Array<ArrayBuffer>

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

    @param arrayLike

    An array-like object to convert to an array.

    from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>

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

    @param arrayLike

    An array-like object to convert to an array.

    @param mapfn

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

    @param thisArg

    Value of 'this' used to invoke the mapfn.

    from(elements: Iterable<number>): Uint8Array<ArrayBuffer>

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

    @param elements

    An iterable object to convert to an array.

    from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>

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

    @param elements

    An iterable object to convert to an array.

    @param mapfn

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

    @param thisArg

    Value of 'this' used to invoke the mapfn.

  • fromBase64(base64: string, options?: { alphabet: 'base64' | 'base64url'; lastChunkHandling: 'loose' | 'strict' | 'stop-before-partial' }): Uint8Array

    Create a new Uint8Array from a base64 encoded string

    @param base64

    The base64 encoded string to convert to a Uint8Array

    @param options

    Optional options for decoding the base64 string

    @returns

    A new Uint8Array containing the decoded data

  • fromHex(hex: string): Uint8Array

    Create a new Uint8Array from a hex encoded string

    @param hex

    The hex encoded string to convert to a Uint8Array

    @returns

    A new Uint8Array containing the decoded data

  • of(...items: number[]): Uint8Array<ArrayBuffer>

    Returns a new array from a set of elements.

    @param items

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