json-file-merger
Version:
A Node.js package for merging large JSON files using streams
31 lines (30 loc) • 1.1 kB
TypeScript
/**
* Gets the size of a file in bytes
* @param filePath Path to the file
* @returns Promise that resolves to the file size in bytes
*/
export declare function getFileSize(filePath: string): Promise<number>;
/**
* Formats bytes into a human-readable string
* @param bytes Number of bytes
* @returns Formatted string with appropriate unit (B, KB, MB, GB, TB)
*/
export declare function formatBytes(bytes: number): string;
/**
* Calculates an optimal chunk size for file processing
* @param totalBytes Total size of files to process
* @returns Optimal chunk size in bytes
*/
export declare function calculateOptimalChunkSize(totalBytes: number): number;
/**
* Gets all JSON files from a directory
* @param directory Path to the directory
* @returns Array of JSON file paths
*/
export declare function getJsonFilesFromDirectory(directory: string): Promise<string[]>;
/**
* Expands glob patterns to get matching files
* @param patterns Array of glob patterns
* @returns Array of matching file paths
*/
export declare function expandGlobPatterns(patterns: string[]): Promise<string[]>;