index.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /// <reference types="node" />
  2. export interface FetcherRequestInit {
  3. method?: string;
  4. headers?: Record<string, string>;
  5. body?: string | Buffer;
  6. signal?: any;
  7. }
  8. export interface FetcherResponse {
  9. readonly bodyUsed: boolean;
  10. readonly url: string;
  11. readonly redirected: boolean;
  12. readonly status: number;
  13. readonly ok: boolean;
  14. readonly statusText: string;
  15. readonly headers: FetcherHeaders;
  16. arrayBuffer(): Promise<ArrayBuffer>;
  17. text(): Promise<string>;
  18. json(): Promise<any>;
  19. clone(): FetcherResponse;
  20. }
  21. export interface FetcherHeaders extends Iterable<[string, string]> {
  22. append(name: string, value: string): void;
  23. delete(name: string): void;
  24. get(name: string): string | null;
  25. has(name: string): boolean;
  26. set(name: string, value: string): void;
  27. entries(): Iterator<[string, string]>;
  28. keys(): Iterator<string>;
  29. values(): Iterator<string>;
  30. [Symbol.iterator](): Iterator<[string, string]>;
  31. }
  32. export type Fetcher = (url: string, init?: FetcherRequestInit) => Promise<FetcherResponse>;
  33. //# sourceMappingURL=index.d.ts.map