/** * An part item of file. */ interface IFilePartItem { /** * Sequence no of a part. */ sid: number; /** * Start position of a part in sourcefile. */ start: number; /** * End position of a part in sourcefile. */ end: number; } interface IBigFileHelperOptions { /** * The suffix name of a file part. * @default '.ghc-part' */ readonly partCodePrefix?: string; } /** * Inspired by https://github.com/tomvlk/node-split-file. */ declare class BigFileHelper { readonly partCodePrefix: string; private readonly _encoding; constructor(options?: IBigFileHelperOptions); /** * Calculate the name of parts of sourcefile respectively. * * @param filepath * @param parts * @returns */ calcPartFilepaths(filepath: string, parts: IFilePartItem[]): string[]; /** * Split file with part descriptions. */ split(filepath: string, parts: IFilePartItem[], outputFilepath?: string): Promise; /** * Merge files * * @param inputFilepaths * @param outputFilepath */ merge(inputFilepaths: string[], outputFilepath: string): Promise; } declare const bigFileHelper: BigFileHelper; /** * Generate file part items by part size. * * @param fileSize * @param _partSize * @returns */ declare function calcFilePartItemsBySize(fileSize: number, _partSize: number): IFilePartItem[]; /** * Generate file part items by total of parts. * * @param filepath * @param _partTotal * @returns */ declare function calcFilePartItemsByCount(fileSize: number, _partTotal: number): IFilePartItem[]; /** * Calculate names of parts of sourcefile respectively. * * @param parts * @param partCodePrefix * @returns */ declare function calcFilePartNames(parts: ReadonlyArray>, partCodePrefix: string): string[]; export { BigFileHelper, type IBigFileHelperOptions, type IFilePartItem, bigFileHelper, calcFilePartItemsByCount, calcFilePartItemsBySize, calcFilePartNames };