Get human readable version of file size?
A function to return human readable size from bytes size: >>> human_readable(2048) ‘2 kilobytes’ >>> How to do this? 24 Answers 24
A function to return human readable size from bytes size: >>> human_readable(2048) ‘2 kilobytes’ >>> How to do this? 24 Answers 24
I’m using this function to convert a file size in bytes to a human-readable file size: function getReadableFileSizeString(fileSizeInBytes) { var i = -1; var byteUnits = [‘ kB’, ‘ MB’, ‘ GB’, ‘ TB’, ‘PB’, ‘EB’, ‘ZB’, ‘YB’]; do { fileSizeInBytes = fileSizeInBytes / 1024; i++; } while (fileSizeInBytes > 1024); return Math.max(fileSizeInBytes, 0.1).toFixed(1) + … Read more
How do I get a human-readable file size in bytes abbreviation using .NET? Example: Take input 7,326,629 and display 6.98 MB 24 Answers 24
What’s a simple way to find the size of my Git repository? And I don’t mean du -h on the root directory of my repository. I have a lot of ignored files, so that size would be different from my total repository size. I essentially want to know how much data would be transferred upon … Read more
I need a way to get the size of a file using C#, and not the size on disk. How is this possible? Currently I have this loop foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { //file.Length (will this work) } Will this return the size or the size on disk? 7 Answers 7