dieumercimvemba's picture
download
raw
1.65 kB
export = fetch;
/**
* Node-style callback as used by {@link util.fetch}.
* @typedef FetchCallback
* @type {function}
* @param {?Error} error Error, if any, otherwise `null`
* @param {string} [contents] File contents, if there hasn't been an error
* @returns {undefined}
*/
type FetchCallback = (error: Error, contents?: string) => void;
/**
* Options as used by {@link util.fetch}.
* @typedef IFetchOptions
* @type {Object}
* @property {boolean} [binary=false] Whether expecting a binary response
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
*/
interface IFetchOptions {
binary?: boolean;
xhr?: boolean;
}
/**
* Fetches the contents of a file.
* @memberof util
* @param {string} filename File path or url
* @param {IFetchOptions} options Fetch options
* @param {FetchCallback} callback Callback function
* @returns {undefined}
*/
declare function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void;
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {FetchCallback} callback Callback function
* @returns {undefined}
* @variation 2
*/
declare function fetch(path: string, callback: FetchCallback): void;
/**
* Fetches the contents of a file.
* @name util.fetch
* @function
* @param {string} path File path or url
* @param {IFetchOptions} [options] Fetch options
* @returns {Promise<string|Uint8Array>} Promise
* @variation 3
*/
declare function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>;

Xet Storage Details

Size:
1.65 kB
·
Xet hash:
0bb0a44b601c83a07353742897ff48aa18e1f9154a8c7a4b542dd2c7f462fdf3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.