util-helpers
Version:
22 lines (21 loc) • 644 B
TypeScript
import ajax from './ajax';
/**
* 获取文件 Blob 。
*
* @alias module:Browser.getFileBlob
* @since 4.21.0
* @param {string | Blob} file 文件地址或对象。
* @param {AjaxOptions} [ajaxOptions] ajax 请求配置项,当传入的图片为字符串时才会触发请求。
* @returns {Promise<Blob>} 文件 Blob 。
* @example
*
* getFileBlob(file).then((blob)=>{
* // do something
* });
*
* getFileBlob('https://dummyimage.com/200x300').then((blob)=>{
* // do something
* });
*/
declare function getFileBlob(file: string | Blob, ajaxOptions?: Parameters<typeof ajax>[1]): Promise<Blob>;
export default getFileBlob;