filesize
filesize copied to clipboard
Humanize file sizes
Refactor code using math log function
The divider should be set to `1000`, which would make the current sizes valid, or the terms used should be updated to those in the binary set (KiB, MiB, GiB).
Please add functionality to parse file size from the input string. for many applications, the file size limit will be given from the backend and it will be like 1MB...
This pull request is regarding the following issue: #6
More specifically, when the size is larger than `1024 MB` but is divisible by `1024` for example, the result would always be `1 GB`. The code below shows this clearer:...
```dart filesize(dynamic size, [int round = 2]) { int _size; try { _size = int.parse(size.toString()); } catch (e) { throw ArgumentError('Can not parse the size parameter: $e'); } } ```
Fixes the code to comply with default lints, which were causing warnings.