TBodyInit
Bun

type

BodyInit

type BodyInit = ReadableStream | Bun.XMLHttpRequestBodyInit | URLSearchParams | AsyncGenerator<string | ArrayBuffer | ArrayBufferView> | () => AsyncGenerator<string | ArrayBuffer | ArrayBufferView>

Referenced types

class ReadableStream<R = any>

This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

  • readonly size: number
  • [Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
  • name: string,
    value: string
    ): void;

    Appends a specified key/value pair as a new search parameter.

    MDN Reference

  • name: string,
    value?: string
    ): void;

    Deletes the given search parameter, and its associated value, from the list of all search parameters.

    MDN Reference

  • entries(): URLSearchParamsIterator<[string, string]>;

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

  • callbackfn: (value: string, key: string, parent: URLSearchParams) => void,
    thisArg?: any
    ): void;

    Iterates over each name-value pair in the query and invokes the given function.

    const myURL = new URL('https://example.org/?a=b&#x26;c=d');
    myURL.searchParams.forEach((value, name, searchParams) => {
      console.log(name, value, myURL.searchParams === searchParams);
    });
    // Prints:
    //   a b true
    //   c d true
    
    @param callbackfn

    Invoked for each name-value pair in the query

    @param thisArg

    To be used as this value for when fn is called

  • name: string
    ): null | string;

    Returns the first value associated to the given search parameter.

    MDN Reference

  • name: string
    ): string[];

    Returns all the values association with a given search parameter.

    MDN Reference

  • name: string,
    value?: string
    ): boolean;

    Returns a Boolean indicating if such a search parameter exists.

    MDN Reference

  • keys(): URLSearchParamsIterator<string>;

    Returns a list of keys in the search params.

  • name: string,
    value: string
    ): void;

    Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.

    MDN Reference

  • toString(): string;

    Returns a string containing a query string suitable for use in a URL. Does not include the question mark.

  • values(): URLSearchParamsIterator<string>;

    Returns a list of values in the search params.

class ArrayBuffer

Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

  • readonly [Symbol.toStringTag]: string
  • readonly byteLength: number

    Read-only. The length of the ArrayBuffer (in bytes).

  • newByteLength?: number
    ): void;

    Resizes the ArrayBuffer to the specified size (in bytes).

    MDN

    byteLength: number

    Resize an ArrayBuffer in-place.

  • begin: number,
    end?: number

    Returns a section of an ArrayBuffer.

  • newByteLength?: number

    Creates a new ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

    MDN

  • newByteLength?: number

    Creates a new non-resizable ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

    MDN

type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> = NodeJS.TypedArray<TArrayBuffer> | DataView<TArrayBuffer>