UNPKG

@wordpress/media-utils

Version:
30 lines 1.25 kB
/** * Internal dependencies */ import type { OnErrorHandler, CreateSideloadFile, RestAttachment, SubSizeData } from './types'; type OnSubSizeHandler = (subSize: SubSizeData) => void; interface SideloadMediaArgs { additionalData?: CreateSideloadFile; file: File; attachmentId: RestAttachment['id']; onError?: OnErrorHandler; onSuccess?: OnSubSizeHandler; signal?: AbortSignal; } /** * Uploads a file to the server without creating an attachment. * * Returns sub-size data instead of a full attachment. The client * accumulates this data and sends it to the finalize endpoint. * * @param $0 Parameters object passed to the function. * @param $0.file Media File to Save. * @param $0.attachmentId Parent attachment ID. * @param $0.additionalData Additional data to include in the request. * @param $0.signal Abort signal. * @param $0.onSuccess Function called when the sideload completes with sub-size data. * @param $0.onError Function called when an error happens. */ export declare function sideloadMedia({ file, attachmentId, additionalData, signal, onSuccess, onError }: SideloadMediaArgs): Promise<void>; export {}; //# sourceMappingURL=sideload-media.d.ts.map