UNPKG

@jingoz/file-slicer

Version:

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

26 lines (23 loc) 531 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 // slice hash partialHash: string // start byte position position: number // slice length offset: number }