minigame-std
    Preparing search index...

    Interface UploadRequestInit

    Request init options for uploadFile.

    interface UploadRequestInit {
        body?: BodyInit | null;
        cache?: RequestCache;
        credentials?: RequestCredentials;
        filename?: string;
        headers?: HeadersInit;
        integrity?: string;
        keepalive?: boolean;
        method?: string;
        mode?: RequestMode;
        onChunk?: (chunk: Uint8Array<ArrayBuffer>) => void;
        onProgress?: (progressResult: IOResult<FetchProgress>) => void;
        priority?: RequestPriority;
        redirect?: RequestRedirect;
        referrer?: string;
        referrerPolicy?: ReferrerPolicy;
        retry?: number | FetchRetryOptions;
        signal?: AbortSignal | null;
        timeout?: number;
        window?: null;
    }

    Hierarchy (View Summary)

    Index

    Properties

    body?: BodyInit | null

    A BodyInit object or null to set request's body.

    cache?: RequestCache

    A string indicating how the request will interact with the browser's cache to set request's cache.

    credentials?: RequestCredentials

    A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.

    filename?: string

    The filename to use when uploading the file.

    headers?: HeadersInit

    A Headers object, an object literal, or an array of two-item arrays to set request's headers.

    integrity?: string

    A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

    keepalive?: boolean

    A boolean to set request's keepalive.

    method?: string

    A string to set request's method.

    mode?: RequestMode

    A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.

    onChunk?: (chunk: Uint8Array<ArrayBuffer>) => void

    Callback invoked when a chunk of data is received.

    Useful for streaming or processing data as it arrives. Each chunk is a Uint8Array<ArrayBuffer> containing the raw bytes.

    Note: This feature uses response.clone() internally. The cloned stream shares the same underlying data source (via tee()), so it does NOT double memory usage. However, if the two streams consume data at different speeds, chunks may be buffered temporarily until both streams have read them.

    Type Declaration

      • (chunk: Uint8Array<ArrayBuffer>): void
      • Parameters

        • chunk: Uint8Array<ArrayBuffer>

          The raw data chunk received from the response stream.

        Returns void

    onProgress?: (progressResult: IOResult<FetchProgress>) => void

    Callback invoked during download to report progress.

    Receives an IOResult<FetchProgress>:

    • Ok(FetchProgress) - Progress update with byte counts
    • Err(Error) - If Content-Length header is missing (called once)

    Note: This feature uses response.clone() internally. The cloned stream shares the same underlying data source (via tee()), so it does NOT double memory usage. However, if the two streams consume data at different speeds, chunks may be buffered temporarily until both streams have read them.

    Type Declaration

      • (progressResult: IOResult<FetchProgress>): void
      • Parameters

        • progressResult: IOResult<FetchProgress>

          The progress result, either success with progress data or error.

        Returns void

    priority?: RequestPriority
    redirect?: RequestRedirect

    A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.

    referrer?: string

    A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.

    referrerPolicy?: ReferrerPolicy

    A referrer policy to set request's referrerPolicy.

    retry?: number | FetchRetryOptions

    Retry options.

    Can be a number (shorthand for retries count) or an options object.

    // Retry up to 3 times on network errors
    const result = await fetchT('https://api.example.com/data', {
    retry: 3,
    });

    // Detailed configuration
    const result = await fetchT('https://api.example.com/data', {
    retry: {
    retries: 3,
    delay: 1000,
    when: [500, 502],
    onRetry: (error, attempt) => console.log(error),
    },
    });
    signal?: AbortSignal | null

    An AbortSignal to set request's signal.

    timeout?: number

    Maximum time in milliseconds to wait for the request to complete.

    If exceeded, the request is automatically aborted with a TimeoutError. Must be a positive number.

    window?: null

    Can only be null. Used to disassociate request from any Window.