Function to convert bytes to an abbreviated format
Number of bytes
Number of digits after the decimal place
String representing the bytes in abbreviated form (KB, MB, GB, etc.)
convertBytesToString(1024); // 1 KBconvertBytesToString(1027); // 1.00 KBconvertBytesToString(1500000); // 1.43 MB Copy
convertBytesToString(1024); // 1 KBconvertBytesToString(1027); // 1.00 KBconvertBytesToString(1500000); // 1.43 MB
Function to convert bytes to an abbreviated format