UNPKG

1.5 kBTypeScriptView Raw
1import { ForAwaitable } from './iter.js';
2export declare type StreamBodyInit = ForAwaitable<string> | ReadableStream<string>;
3export declare type ByteStreamBodyInit = ForAwaitable<Uint8Array> | ReadableStream<Uint8Array>;
4export declare class StreamResponse extends Response {
5 constructor(body?: StreamBodyInit | null, init?: ResponseInit);
6}
7export declare class ByteStreamResponse extends Response {
8 constructor(body?: ByteStreamBodyInit | null, init?: ResponseInit);
9}
10/**
11 * If for any reason you don't want to use streaming response bodies,
12 * you can use this class instead, which will buffer the entire body before releasing it to the network.
13 * Note that headers will still be sent immediately.
14 */
15export declare class BufferedStreamResponse extends Response {
16 constructor(body?: StreamBodyInit | null, init?: ResponseInit);
17}
18export declare class BufferedByteStreamResponse extends Response {
19 constructor(body?: ByteStreamBodyInit | null, init?: ResponseInit);
20}
21export { BufferedStreamResponse as BufferedResponse };
22export declare type StreamRequestInit = Omit<RequestInit, 'body'> & {
23 body?: StreamBodyInit;
24};
25export declare type ByteStreamRequestInit = Omit<RequestInit, 'body'> & {
26 body?: ByteStreamBodyInit;
27};
28export declare class StreamRequest extends Request {
29 constructor(input: RequestInfo, init?: StreamRequestInit);
30}
31export declare class ByteStreamRequest extends Request {
32 constructor(input: RequestInfo, init?: ByteStreamRequestInit);
33}