avoidwork / filesize.js

JavaScript library to generate a human readable String describing the file size
https://filesizejs.com
BSD 3-Clause "New" or "Revised" License
1.61k stars 97 forks source link

Possibility to show filesize as byte and not bit #25

Closed zauni closed 11 years ago

zauni commented 11 years ago

It would be nice to have an option to specify that one wants to see the size just in bytes. On Windows it's not common to see filesizes in bits.

For example, I have a file which is 265318 bytes and it translates to 2.02Mb, which is correct, but I would like to have it translated to 259.10KB.

Would it be possible to have this option? :)

avoidwork commented 11 years ago

Hi,

I've added a new optional parameter to disable bit sizes. The second parameter is required to utilize the new functionality:

filesize(265318, 2, false) // 259.10KB
zauni commented 11 years ago

Thank you very much!