UNPKG

scratch-storage

Version:

Load and store project and asset files for Scratch 3.0

34 lines (33 loc) 1.27 kB
import { ScratchGetRequest, ScratchSendRequest, Tool } from './Tool'; /** * @typedef {Request & {withCredentials: boolean}} ScratchSendRequest */ /** * Get and send assets with the fetch standard web api. */ export declare class FetchTool implements Tool { /** * Is get supported? * Always true for `FetchTool` because `scratchFetch` ponyfills `fetch` if necessary. * @returns {boolean} Is get supported? */ get isGetSupported(): boolean; /** * Request data from a server with fetch. * @param {Request} reqConfig - Request configuration for data to get. * @returns {Promise.<Uint8Array?>} Resolve to Buffer of data from server. */ get({ url, ...options }: ScratchGetRequest): Promise<Uint8Array | null>; /** * Is sending supported? * Always true for `FetchTool` because `scratchFetch` ponyfills `fetch` if necessary. * @returns {boolean} Is sending supported? */ get isSendSupported(): boolean; /** * Send data to a server with fetch. * @param {ScratchSendRequest} reqConfig - Request configuration for data to send. * @returns {Promise.<string>} Server returned metadata. */ send({ url, withCredentials, ...options }: ScratchSendRequest): Promise<string>; }