UNPKG

769 BTypeScriptView Raw
1import { KeyValueCache } from 'fetchache';
2import { fetch } from 'cross-fetch';
3import isUrl from 'is-url';
4export { isUrl };
5interface ReadFileOrUrlOptions extends RequestInit {
6 allowUnknownExtensions?: boolean;
7 fallbackFormat?: 'json' | 'yaml';
8 cwd?: string;
9 fetch?: typeof fetch;
10}
11export declare function getCachedFetch(cache: KeyValueCache): typeof fetch;
12export declare function readFileOrUrlWithCache<T>(filePathOrUrl: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T>;
13export declare function readFileWithCache<T>(filePath: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T>;
14export declare function readUrlWithCache<T>(path: string, cache: KeyValueCache, config?: ReadFileOrUrlOptions): Promise<T>;