Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

File-size reported at the top of the HTML file is calculated incorrectly #131

Closed
IjzerenHein opened this issue Aug 12, 2019 · 2 comments 路 Fixed by #138
Closed

File-size reported at the top of the HTML file is calculated incorrectly #131

IjzerenHein opened this issue Aug 12, 2019 · 2 comments 路 Fixed by #138
Assignees
Milestone

Comments

@IjzerenHein
Copy link

Hi, first of all, awesome library, great job man! 馃憦 馃憦

I found a somewhat annoying issue. The file-size shown at the top of the HTML file is calculated incorrectly. In the following example, the bundle has a file-size of 3060595 bytes, which corresponds to 2.918.. Megabytes. The header however shows 3.06.

image

image

It seems it is dividing by 1000000, but it should divide by 1024 * 1024.

@danvk
Copy link
Owner

danvk commented Aug 12, 2019

I thought we fixed this in #54.

Update: looks like it was changed to default to base 10, not base 2. @nikolay-borzov do you remember why this changed?

export function formatBytes(bytes: number, decimals = 2, base: 1000 | 1024 = 1000): string {

@nikolay-borzov
Copy link
Collaborator

Don't remember. Maybe it's a migration issue. I'l fix it

@nikolay-borzov nikolay-borzov added this to the 2.1.1 milestone Nov 9, 2019
nikolay-borzov added a commit that referenced this issue Nov 9, 2019
@nikolay-borzov nikolay-borzov self-assigned this Nov 9, 2019
nikolay-borzov added a commit that referenced this issue Nov 9, 2019
- Change base from 1000 (bits) to 1024 (bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants