@bubblewrap/core
Version:
Core Library to generate, build and sign TWA projects
18 lines (17 loc) • 906 B
TypeScript
import { Response as FetchH2Response } from 'fetch-h2';
import { Response as NodeFetchResponse } from 'node-fetch';
export type FetchEngine = 'node-fetch' | 'fetch-h2';
export type NodeFetchOrFetchH2Response = FetchH2Response | NodeFetchResponse;
declare class FetchUtils {
private fetchEngine;
setFetchEngine(newFetchEngine: FetchEngine): void;
fetch(input: string): Promise<NodeFetchOrFetchH2Response>;
/**
* Downloads a file from `url` and saves it to `path`. If a `progressCallback` function is passed, it
* will be invoked for every chunk received. If the value of `total` parameter is -1, it means we
* were unable to determine to total file size before starting the download.
*/
downloadFile(url: string, path: string, progressCallback?: (current: number, total: number) => void): Promise<void>;
}
declare const fetchUtils: FetchUtils;
export { fetchUtils };