db-file
Version:
32 lines (31 loc) • 996 B
TypeScript
/** 分片数据接口定义 */
interface ChunkData {
/** 分片起始位置 */
start: number;
/** 分片结束位置 */
end: number;
/** 分片索引 */
index: number;
/** 分片哈希值 */
hash: string;
/** 分片数据 */
blob: Blob;
}
/**
* 创建文件分片
* @param file - 要分片的文件
* @param index - 分片索引
* @param chunkSize - 分片大小
* @returns Promise<ChunkData> 分片数据
*/
export declare function createChunk(file: File, index: number, chunkSize: number): Promise<ChunkData>;
/**
* 大文件分片处理
* @param file - 要处理的文件
* @param chunkSize - 分片大小(字节),默认 20MB
* @returns Promise<ChunkData[]> 分片数据数组
*/
export declare function createFileChunks(file: File, chunkSize?: number): Promise<Promise<ChunkData>[]>;
/** @deprecated 请使用 createFileChunks 代替 */
export declare const cutFile: typeof createFileChunks;
export {};