UNPKG

@worker-tools/json-stream

Version:

Utilities for working with streaming JSON in Worker Runtimes such as Cloudflare Workers, Deno Deploy and Service Workers.

15 lines (14 loc) 650 B
import { StreamResponse, StreamRequest } from "@worker-tools/stream-response"; export declare type JSONStreamBodyInit = ReadableStream<string> | AsyncIterable<string> | any; export declare type JSONStreamRequestInit = Omit<RequestInit, 'body'> & { body?: JSONStreamBodyInit; }; export declare class JSONStreamRequest extends StreamRequest { static contentType: string; static accept: string; constructor(input: RequestInfo | URL, init?: JSONStreamRequestInit); } export declare class JSONStreamResponse extends StreamResponse { static contentType: string; constructor(body?: JSONStreamBodyInit | null, init?: ResponseInit); }