/**
 * Function to convert file size in bytes to human readable format
 * @param size - size of the file in bytes
 * @returns {string} - human readable file size
 * @example <caption>Example usage of readableFileSize</caption>
 * readableFileSize(1024) // returns '1 kB'
 * readableFileSize(1024 * 1024 * 1024) // returns '1 GB'
 */
export function readableFileSize(size) {
    const i = size !== 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;
    return `${Number((size / Math.pow(1024, i)).toFixed(2))} ${["B", "kB", "MB", "GB", "TB"][i]}`;
}
//# sourceMappingURL=fileSize.js.map