UNPKG

db-file

Version:
33 lines (32 loc) 1.05 kB
import { createChunk, cutFile } from './filesplit'; /** 上传回调函数接口 */ interface UploadCallbacks { (files: FileList, status?: boolean, errorType?: 'size' | 'type'): void; } /** 上传选项接口 */ interface UploadOptions { /** 允许的文件类型数组 */ type?: string[]; /** 最大文件大小(字节) */ size?: number; } /** * 文件上传函数 * @param callbacks - 上传回调函数 * @param options - 上传选项 * @throws {Error} 当未传入回调函数时抛出错误 */ export declare function upload(callbacks: UploadCallbacks, options?: UploadOptions): void; /** * 文件下载函数 * @param fileName - 下载文件的名称 * @param data - 要下载的数据 */ export declare function download(fileName: string, data: BlobPart): void; /** * 文件转Base64函数 * @param file - 要转换的文件 * @returns Promise<string> Base64编码的字符串 */ export declare function uploadBase(file: Blob): Promise<string>; export { createChunk, cutFile };