sized_file 1.0.2
sized_file: ^1.0.2 copied to clipboard
A lightweight Dart package for handling file size conversions and formatting. Convert between bytes, KB, MB, GB, and TB with easy-to-use utilities.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2025-10-21 #
Added #
- Initial release of the
sized_filepackage SizedFileclass for handling file size conversions and formatting- Support for multiple size units: bytes (B), kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB)
- Constructors for creating instances from any unit:
SizedFile.b(),SizedFile.kb(),SizedFile.mb(),SizedFile.gb(),SizedFile.tb() - Properties to access size in different units:
inBytes,inKB,inMB,inGB - Smart
format()method that automatically selects the most appropriate unit for display - Customizable fraction digits in formatting (default: 2 decimal places)
- Support for custom postfixes (unit labels) per format call
- Global postfix generator for internationalization support via
setPostfixesGenerator() - Binary divider (1024) for accurate storage size calculations
- Comprehensive unit tests with 32 test cases covering all features
- Complete API documentation with examples
- Example code demonstrating real-world use cases
- README with detailed usage instructions and practical examples
Features #
- Zero dependencies - pure Dart implementation
- Lightweight and performant
- Type-safe API with proper error handling
- Fully documented code with dartdoc comments
- Tested and verified with 100% test coverage