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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filesize(1024); does not give "1.02 kB" #154

Closed
rolandstarke opened this issue Jun 16, 2022 · 4 comments
Closed

filesize(1024); does not give "1.02 kB" #154

rolandstarke opened this issue Jun 16, 2022 · 4 comments

Comments

@rolandstarke
Copy link

rolandstarke commented Jun 16, 2022

The Readme has an example of:

filesize(1024);                       // "1.02 kB"

But the actual output is:

filesize(1024);                       // "1.02 kiB"

Would be cool if it worked like in the Readme.
Also see: #150

For Anyone else you can use v8.0.7

<script src="https://unpkg.com/filesize@8.0.7/lib/filesize.min.js" defer></script>
@avoidwork
Copy link
Owner

avoidwork commented Jun 16, 2022

It does work like the README.md says, the first option (base) has a default of 10. I've removed the outdated examples to remove confusion.

This is probably what you're looking for: https://github.com/avoidwork/filesize.js#partial-application

@rolandstarke
Copy link
Author

rolandstarke commented Jun 17, 2022

Thanks for removing the confusion from the README.md.

I don't care about the default base change. I actually want base 10.

My only complaint is that there is an i in the unit, but i indicates base 2.

I am looking for using the SI prefix for base 10.
See https://wiki.ubuntu.com/UnitsPolicy or https://en.m.wikipedia.org/wiki/Byte#Multiple-byte_units
Releates: #141, #150 (comment)
v2.0.0 to v8.0.7 supported it.

@avoidwork
Copy link
Owner

avoidwork commented Jun 17, 2022

totally agree. 9.0.0 shifted it because #152 is the cause of the regression.

there's 2 camps which do not agree on how it works. I'll return the original behavior.

@avoidwork
Copy link
Owner

This is 9.0.9.

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

No branches or pull requests

2 participants