Bun

interface

Uint8ArrayConstructor

interface Uint8ArrayConstructor

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

    The size in bytes of each element in the array.

  • readonly prototype: Uint8Array<ArrayBufferLike>
  • arrayLike: ArrayLike<number>

    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

    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.

    elements: Iterable<number>

    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

    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.

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

    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

  • hex: string

    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

  • ...items: number[]

    Returns a new array from a set of elements.

    @param items

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