UNPKG

@jingoz/file-slicer

Version:

@jingoz/file-slicer 是一个 npm 包,提供了文件根据自定义大小分片并计算 hash 的功能。

21 lines (20 loc) 487 B
export interface IFileWithHash { fullHash: string; fileSize: number; fileName: string; fileType: string; filePath: string; calcFileHash(): Promise<void>; } export interface IFileSlicer extends IFileWithHash { chunkSize: number; chunks: IChunkItem[]; splitFile(start?: number, end?: number): Promise<void>; destroy(): void; } export interface IChunkItem { body: ArrayBuffer; partialHash: string; position: number; offset: number; }