Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aguilaair/filesize
Humanize file sizes
https://github.com/aguilaair/filesize
Last synced: 8 days ago
JSON representation
Humanize file sizes
- Host: GitHub
- URL: https://github.com/aguilaair/filesize
- Owner: aguilaair
- License: bsd-2-clause
- Created: 2021-03-10T07:44:17.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-14T22:16:32.000Z (almost 4 years ago)
- Last Synced: 2024-11-05T18:52:18.552Z (2 months ago)
- Language: Dart
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Filesize
[![pub package](https://img.shields.io/pub/v/filesize_plus.svg)](https://pub.dartlang.org/packages/filesize_plus) [![Dart](https://github.com/aguilaair/filesize/actions/workflows/dart.yml/badge.svg)](https://github.com/aguilaair/filesize/actions/workflows/dart.yml)
A micro library that provides an easy way to get human readable file size strings. Now with null safety!
## Features
- Size can be passed as number or as string
- Optional parameter to specify numbers of digits after comma/point## Examples
``` dart
filesize(1024); // "1 KB"
filesize(664365320); // "633.59 MB"
filesize(4324324232343); // "3.93 TB"
```Optional parameter to specify numbers after comma/point:
``` dart
filesize(664365320, 4); // "633.5881 MB"
filesize(4324324232343, 3); // "3.932 TB"
```Inspired by [filesize.js](https://github.com/avoidwork/filesize.js "filesize.js")