shims.d.ts 1.0 KB

1234567891011121314151617181920
  1. import type { Fetch } from "./builtin-types.js";
  2. import type { ReadableStream } from "./shim-types.js";
  3. export declare function getDefaultFetch(): Fetch;
  4. type ReadableStreamArgs = ConstructorParameters<typeof ReadableStream>;
  5. export declare function makeReadableStream(...args: ReadableStreamArgs): ReadableStream;
  6. export declare function ReadableStreamFrom<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
  7. /**
  8. * Most browsers don't yet have async iterable support for ReadableStream,
  9. * and Node has a very different way of reading bytes from its "ReadableStream".
  10. *
  11. * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
  12. */
  13. export declare function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
  14. /**
  15. * Cancels a ReadableStream we don't need to consume.
  16. * See https://undici.nodejs.org/#/?id=garbage-collection
  17. */
  18. export declare function CancelReadableStream(stream: any): Promise<void>;
  19. export {};
  20. //# sourceMappingURL=shims.d.ts.map