human_file_size

astropy.utils.console.human_file_size(size)[source] [edit on github]

Returns a human-friendly string representing a file size that is 2-4 characters long.

For example, depending on the number of bytes given, can be one of:

256b
64k
1.1G
Parameters:
size : int

The size of the file (in bytes)

Returns:
size : str

A human-friendly representation of the size of the file