Skip to content

Improve file size handling and parsing in browser.js #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: hovudstraum
Choose a base branch
from

Conversation

Masked-Code
Copy link
Contributor

  • Add formatSize function for better size formatting
  • Store raw file sizes in data-sz attributes
  • Fix size parsing to handle both spaces and commas
  • Use humansize() for consistent display formatting

I am new to contributing to open source, so if this broken or incorrect in some way; all feedback is appreciated.

This PR complies with the DCO; https://developercertificate.org/

- Add formatSize function for better size formatting
- Store raw file sizes in data-sz attributes
- Fix size parsing to handle both spaces and commas
- Use humansize() for consistent display formatting
Comment on lines +343 to +345
if (bytes < 1024) return bytes + ' B';
let k = 1024;
let sizes = ['B', 'KB', 'MB', 'GB', 'TB'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are using 1024 multiples, I recommbed the "-ibi" suffixes instead.
So Kibibyte (KiB), Mebibyte (MiB), and so on.

More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants