https://github.com/jonaswanke/data_size
🔟 Customizable data size (bit & byte) formatting for interfacing with the user
https://github.com/jonaswanke/data_size
bit byte dart data-size formatting package
Last synced: about 1 year ago
JSON representation
🔟 Customizable data size (bit & byte) formatting for interfacing with the user
- Host: GitHub
- URL: https://github.com/jonaswanke/data_size
- Owner: JonasWanke
- License: mit
- Created: 2020-05-28T05:59:57.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-27T12:32:40.000Z (over 1 year ago)
- Last Synced: 2025-02-26T15:54:04.489Z (over 1 year ago)
- Topics: bit, byte, dart, data-size, formatting, package
- Language: Dart
- Homepage: https://pub.dev/packages/data_size
- Size: 70.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
🔟 Customizable data size (bit & byte) formatting for interfacing with the user

[](https://codecov.io/gh/JonasWanke/data_size)
## Features
* format `DataUnit.bit` and `DataUnit.byte`
* select a prefix:
* `Prefix.decimal` (kB, MB, … with multiples of 1000)
* `Prefix.binary` (KiB, MiB, … with multiples of 1024)
* select a precision (number of decimal places)
## Examples
```dart
final defaultString = 12345.formatByteSize(); // "12.35 kB"
final noDecimalPlaces = 12345.formatByteSize(precision: 0); // "12 kB"
final binaryPrefix = 12345.formatByteSize(prefix: Prefix.binary); // "12.06 KiB"
final bits = 12345.formatBitSize(); // "12.35 kb"
```