Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AnmolSethi/file_size
Get the Human readable size of the file.
https://github.com/AnmolSethi/file_size
dart dart-package filesize flutter flutter-package
Last synced: 2 months ago
JSON representation
Get the Human readable size of the file.
- Host: GitHub
- URL: https://github.com/AnmolSethi/file_size
- Owner: AnmolSethi
- License: mit
- Created: 2021-03-27T00:41:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-15T11:27:50.000Z (over 3 years ago)
- Last Synced: 2024-08-01T12:28:15.328Z (5 months ago)
- Topics: dart, dart-package, filesize, flutter, flutter-package
- Language: Dart
- Homepage: https://pub.dev/packages/file_sizes
- Size: 19.5 KB
- Stars: 5
- Watchers: 2
- 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/file_sizes.svg)](https://pub.dartlang.org/packages/file_sizes) [![Dart](https://github.com/aguilaair/filesize/actions/workflows/dart.yml/badge.svg)](https://github.com/AnmolSethi/file_sizes/actions/workflows/dart.yml)
Get the Human readable size of the file. It is purely written in dart and support both number and string as parameters.
## Examples
> getSize(string or number, {PrecisionValue}): returns String
- Direct Method Call
```dart
FileSize.getSize(1000) '1.00 KB'
FileSize.getSize(1048576) '1.04 MB'
FileSize.getSize(1073741824) '1.00 GB'
FileSize.getSize(1099511627776) '1.00 TB'
```- Method call with PrecisionValue [Optional]
```dart
FileSize.getSize(664365320, PrecisionValue.THREE) "633.588 MB"
FileSize.getSize(4324324232343, PrecisionValue.FOUR) "3.9321 TB"
```- Method call without decimal value
```dart
FileSize.getSize(664365320, PrecisionValue.NONE) "633 MB"
FileSize.getSize(4324324232343, PrecisionValue.NONE) "3 TB"
```> getKiloBytes(string or number, {PrecisionValue}): returns String
```dart
FileSize.getKiloBytes(54613) '54.61 KB'
```