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

Support negative numbers #12

Closed sindresorhus closed 11 years ago

sindresorhus commented 11 years ago

require('filesize')(-4) returns an empty string. Should return -4.00B.

avoidwork commented 11 years ago

What's the use case where this is valid? I'm unaware of any file system allowing for smaller than 0B files.

sindresorhus commented 11 years ago

If you want to show the size difference of something.

Example: https://github.com/sindresorhus/grunt-sizediff