Skip to content
pubscout

proper_filesize

1.0.2, released 2 years ago by an unverified publisher

Standalone library for converting between raw bytes and human-readable file sizes in Dart.

WASM-ready
$ flutter pub add proper_filesize
Source repository

What it does

Converts byte values into human-readable strings like '1.2 KB' or '3.5 MB', and parses those strings back into numeric byte values. It supports both binary (KiB, MiB) and metric (KB, MB) units with customizable precision and format types.

AI-written summary of version 1.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display file sizes in a user interface
  • You are handling file uploads or downloads requiring formatted sizes
  • You need to parse human-readable storage sizes into raw bytes

Skip it when

  • You are performing complex file system traversal or IO operations

Strengths

  • Supports both metric and binary units
  • Handles both parsing and formatting of file sizes
  • Configurable decimal precision and long/short format types

Weaknesses

  • Limited to file size formatting and conversion only

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:proper_filesize/proper_filesize.dart';

int bytes = 1243560000;
String binaryFilesize = FileSize.fromBytes(bytes).toString();
print('$bytes bytes is $binaryFilesize');

Alternatives

Packages that do the same job and could replace proper_filesize.

  • physical

    Library for dealing with physical quantities, units, and conversions.

  • units_converter

    Lightweight Dart package for internationalizing and converting units of measurement.

  • acronym

    A simple package to generate acronyms from strings with support for stop words and syllables.

  • filesize

    Translate raw file size numbers or strings into human readable strings.