Close

What are you looking for?

cancel
Showing results for 
Search instead for 
Did you mean: 

File sizes

(Topic created on: 09-12-2023 11:52 AM)
428 Views
0250
First Poster
Options

Hello!

 

How can I return file sizes calculating method to normal (binary)? It's very confusing and disconcerting that the sizes of files are not actual..

0 Likes
2 REPLIES 2
Lord_Shiva
Voyager
Options
Try this java script
function getReadableFileSizeString(fileSizeInBytes) { var i = -1; var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; do { fileSizeInBytes /= 1024; i++; } while (fileSizeInBytes > 1024); return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; }
0 Likes
Lord_Shiva
Voyager
Options
function getReadableFileSizeString(fileSizeInBytes) { var i = -1; var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; do { fileSizeInBytes /= 1024; i++; } while (fileSizeInBytes > 1024); return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; } console.log(getReadableFileSizeString(
0 Likes