Path: blob/master/node_modules/@protobufjs/fetch/index.d.ts
1126 views
export = fetch;12/**3* Node-style callback as used by {@link util.fetch}.4* @typedef FetchCallback5* @type {function}6* @param {?Error} error Error, if any, otherwise `null`7* @param {string} [contents] File contents, if there hasn't been an error8* @returns {undefined}9*/10type FetchCallback = (error: Error, contents?: string) => void;1112/**13* Options as used by {@link util.fetch}.14* @typedef FetchOptions15* @type {Object}16* @property {boolean} [binary=false] Whether expecting a binary response17* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest18*/1920interface FetchOptions {21binary?: boolean;22xhr?: boolean23}2425/**26* Fetches the contents of a file.27* @memberof util28* @param {string} filename File path or url29* @param {FetchOptions} options Fetch options30* @param {FetchCallback} callback Callback function31* @returns {undefined}32*/33declare function fetch(filename: string, options: FetchOptions, callback: FetchCallback): void;3435/**36* Fetches the contents of a file.37* @name util.fetch38* @function39* @param {string} path File path or url40* @param {FetchCallback} callback Callback function41* @returns {undefined}42* @variation 243*/44declare function fetch(path: string, callback: FetchCallback): void;4546/**47* Fetches the contents of a file.48* @name util.fetch49* @function50* @param {string} path File path or url51* @param {FetchOptions} [options] Fetch options52* @returns {Promise<string|Uint8Array>} Promise53* @variation 354*/55declare function fetch(path: string, options?: FetchOptions): Promise<(string|Uint8Array)>;565758