import * as FormData from 'form-data'; export type FetcherOptions = { baseUrl?: string; headers?: Record; query?: Record; method?: 'HEAD' | 'GET' | 'POST'; readHeaders?: string[]; body?: Record | string | FormData | URLSearchParams; }; // Version of the options that always has the defaults set // This is to make making fetchers yourself easier export type DefaultedFetcherOptions = { baseUrl?: string; body?: Record | string | FormData; headers: Record; query: Record; readHeaders: string[]; method: 'HEAD' | 'GET' | 'POST'; }; export type FetcherResponse = { statusCode: number; headers: Headers; finalUrl: string; body: T; }; // This is the version that will be inputted by library users export type Fetcher = { (url: string, ops: DefaultedFetcherOptions): Promise>; }; // This is the version that scrapers will be interacting with export type UseableFetcher = { (url: string, ops?: FetcherOptions): Promise; full: (url: string, ops?: FetcherOptions) => Promise>; };