Skip to content
Advertisement

Python libraries to calculate human readable filesize from bytes?

I find hurry.filesize very useful but it doesn’t give output in decimal?

For example:

JavaScript

But later when I add all the values I don’t get the exact sum. For example if the output of hurry.filesize is in 4 variable and each value is 3. If I add them all, I get output as 15.

I am looking for alternative of hurry.filesize to get output in decimals too.

Advertisement

Answer

This isn’t really hard to implement yourself:

JavaScript

Examples:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement