UNPKG

@typespec/ts-http-runtime

Version:

Isomorphic client library for making HTTP requests in node.js and browser.

42 lines 1.78 kB
/** * Accepted binary data types for concat * * React Native doesn't natively provide ReadableStream or NodeJS.ReadableStream, * but apps may polyfill them. The structural stream type lets callers pass polyfilled * stream objects; they are handled at runtime via duck-typing (isWebReadableStream). * * @internal */ export type ConcatSource = Uint8Array<ArrayBuffer> | Blob | { getReader(): unknown; tee(): unknown; }; /** * Utility function that concatenates a set of binary inputs into one combined output. * * React Native runs on the Hermes engine, which implements a subset of web * APIs with narrower type contracts than full browsers: * * - **Blob**: natively supported, but its constructor only accepts * `(Blob | string)[]` — NOT the full `BlobPart[]` union. Passing a * `Uint8Array` to `new Blob([uint8])` throws at runtime. * See https://github.com/facebook/react-native/issues/44125 * * - **Uint8Array**: works as a data type, but cannot be passed to the Blob * constructor without a polyfill (e.g. react-native-blob-jsi-helper). * See https://github.com/facebook/react-native/issues/41079 * * - **ReadableStream / Response**: not available by default. Apps can polyfill * these (e.g. web-streams-polyfill + react-native-fetch-api). * * This implementation handles all source types and defers to the runtime, * so apps with the appropriate polyfills get correct behavior while apps * without them get the engine's native error. * * @param sources - array of sources for the concatenation * @returns a `Blob` representing all the concatenated inputs. * * @internal */ export declare function concat(sources: (ConcatSource | (() => ConcatSource))[]): Promise<Blob>; //# sourceMappingURL=concat-react-native.d.mts.map