use-ffmpeg
Version:
A React hook for browser-based media processing using FFmpeg WASM - handles video and other file formats conversion with ease
22 lines • 894 B
TypeScript
/**
* converts a file size in bytes to human-readable format
*
* This function takes the size of a file in bytes and formats it into a more
* readable string representation using units such as KB, MB, GB, or TB.
* If the size is `undefined`, it returns "unknown size".
*
* @param {number | undefined} size - The size of the file in bytes. If `undefined`, the size is unknown
* @returns {string} The formated file size, or "unknown size" if the input is `undefined`
*
* @example
* // Example 1: Formatting a small size
* formatFileSize(1024); // Returns "1.00 KB"
*
* // Example 2: Formatting a larger size
* formatFileSize(1048576); // Returns "1.00 MB"
*
* // Example 3: Handling undefined input
* formatFileSize(undefined); // Returns "unknown size"
*/
export declare const formatFileSize: (size: number | undefined) => string;
//# sourceMappingURL=formatFileSize.d.ts.map