byte_converter_lite library

Classes

BigByteConverter
High-performance byte unit converter using BigInt for arbitrary precision.
BigByteStats
Statistical utilities operating on very large byte magnitudes using BigInt.
BigDataRate
BigInt-precision data rate stored as bits per second.
BigHistogram
Histogram wrapper for BigInt buckets. A histogram with BigInt BigHistogramBuckets. A histogram with BigInt BigHistogramBuckets. Histogram of BigHistogramBuckets for BigInt magnitudes.
BigHistogramBucket
A histogram bucket for BigInt magnitudes. A single histogram bucket for BigInt magnitudes. A single histogram bucket for BigInt magnitudes. Represents a histogram bucket for BigInt-sized magnitudes.
ByteConverter
High-performance byte unit converter with caching.
ByteDelta
Represents a signed change in bytes with arbitrary precision.
ByteFormatOptions
Reusable formatter options for humanizing sizes and transfer rates.
ByteRange
Inclusive-exclusive byte range [start, end) backed by BigInt.
BytesMeter
A transformer that reports byte throughput while passing data through.
ByteStats
Numeric aggregations over mixed byte-like inputs (double, int, BigInt, converters). Aggregations and utilities over byte magnitudes. Aggregations and utilities over byte magnitudes. Statistical utilities over collections of byte-like values.
CompoundFormatOptions
Options controlling compound mixed-unit formatting, e.g. "1 GiB 234 MiB 12 KiB".
DataRate
Represents a network/data rate. Internally stored as bits per second.
FormatterSnapshot
Utility for generating snapshot matrices of formatted byte sizes or data rates.
Histogram
Histogram of HistogramBuckets for double-based magnitudes.
HistogramBucket
Represents a histogram bucket for double-based magnitudes with an optional inclusive upperBound and associated count.
OSParsingModes
Adapters to parse sizes from common external libraries/outputs.
ParsedBig
Parsed result carrying a BigByteConverter for very large magnitudes. Large parsed result backed by a BigByteConverter.
ParsedByteSize
Abstract view over an auto-parsed byte size, which may be backed by a regular-precision or BigInt-precision implementation depending on size.
ParsedNormal
Normal-sized parsed result backed by a ByteConverter.
ParseError
Structured error information produced by parse helpers.
ParseResult<T>
Result wrapper for non-throwing parse helpers.
RateWindow
Represents a window of rate over a time span, for planning variable schedules.
StorageAlignment
Describes a single alignment class within a StorageProfile.
StorageProfile
Defines storage alignment preferences used by byte converters when rounding to device-specific bucket sizes such as sectors, blocks, or pages.
StreamingQuantiles
Streaming quantile estimator interface with factory constructors for P² (default) and TDigest implementations.
StreamProgress
Snapshot of a transfer stream's progress.
TDigest
Lightweight t-digest implementation for streaming quantile estimation.
TransferPlan
Simple transfer planning model for estimating ETAs and progress.

Enums

BigSizeUnit
Size units for BigByteConverter with support for larger SI magnitudes.
ByteStandard
Unit standards/prefix systems used for formatting and parsing.
RoundingMode
Rounding modes for converting fractional values to integers.
SizeUnit
Byte size units for standard precision conversions (up to PB).

Extensions

BigDataRatePlanning on BigDataRate
Planning helpers for computing transferable bytes over a duration at a given BigDataRate. Methods avoid rounding drift by using integer math.
BigIntByteConverterExtension on BigInt
Extensions for BigInt to create BigByteConverter instances.
ByteConverterTransfer on ByteConverter
ByteConverter helpers for transfer planning.
DataRatePlanning on DataRate
DataRate helpers for planning.
DoubleByteConverterExtension on double
Extensions for double to create ByteConverter instances.
IntByteConverterExtension on int
Extensions for int to create ByteConverter instances.
TransferPlanAdvanced on TransferPlan
Advanced controls: schedules, pause/resume, and throttling.

Functions

clearLocalizedSingularNames(String locale) → void
Clears previously registered localized singular-name overrides for locale.
clearLocalizedSynonyms(String locale) → void
Clears previously registered localized synonyms for locale.
clearLocalizedUnitNames(String locale) → void
Clears previously registered localized unit names for locale.
disableByteConverterLite() → void
Disable the lightweight number formatter and fall back to defaults.
disableDefaultLocalizedUnitNames() → void
Disable built-in default localized unit names to enable tree-shaking strategies. Disables the built-in default localized unit names to aid tree-shaking.
enableByteConverterLite() → void
Enable a lightweight, no-intl number formatter for humanized output.
enableDefaultLocalizedUnitNames() → void
Re-enable built-in default localized unit names. Re-enables the built-in default localized unit names.
fastHumanizeIecBytes(double bytes, {int precision = 2}) String
Ultra-fast formatter for simple IEC bytes use-cases. Units: B, KiB, MiB, GiB, TiB, PiB.
fastHumanizeSiBits(double bytes, {int precision = 2}) String
Ultra-fast formatter for SI bits.
fastHumanizeSiBytes(double bytes, {int precision = 2}) String
Ultra-fast formatter for simple SI bytes use-cases.
localizedUnitName(String symbol, {String? locale}) String?
Returns a localized full name for a canonical unit symbol for the given locale (base-locale fallback). Returns null when no mapping is found.
localizedUnitSingularName(String symbol, {String? locale, bool bits = false}) String?
Returns a singular name for the given unit symbol if available for the locale. Falls back to plural name when no singular registered. Returns the singular form for a unit symbol in locale when available. Falls back to plural when no singular is registered.
parseByteSizeAuto(String input, {ByteStandard standard = ByteStandard.si, RoundingMode rounding = RoundingMode.round, double thresholdBytes = 9.22e18}) ParsedByteSize
Parses input and returns either ByteConverter or BigByteConverter depending on thresholdBytes. Useful when inputs may exceed 64-bit range. Values >= thresholdBytes are parsed and returned as ParsedBig.
parseLocalized(String input, {String? locale, ByteStandard standard = ByteStandard.si}) ParseResult<ByteConverter>
Parses a size string using locale-aware unit words and number formats when available. Uses resolveLocalizedUnitSymbol and number normalization to reconstruct a canonical parse input before delegating to the core parser.
registerLocalizedSingularNames(String locale, Map<String, String> singular) → void
Register singular forms for full-form names per locale (optional). keys must be canonical plural names from localizedUnitName (e.g., 'kilobytes'), values singular (e.g., 'kilobyte'). Registers singular forms for full-form names per locale. Keys must be canonical plural names returned by localizedUnitName (e.g., 'kilobytes').
registerLocalizedSynonyms(String locale, Map<String, String> synonyms) → void
Register per-locale synonyms that map localized words back to canonical symbols. Example (fr): { 'octet': 'B', 'octets': 'B', 'kilooctets': 'KB', 'ko': 'KB' } Registers per-locale synonyms mapping localized words back to canonical symbols, used during parsing (e.g., 'octets' -> 'B'). Keys are matched case-insensitively.
registerLocalizedUnitNames(String locale, Map<String, String> names) → void
Registers custom localized full names for a locale. Keys must be canonical symbols (e.g., KB, MiB, kb).
resolveLocalizedUnitSymbol(String token, {String? locale}) String?
Resolve a localized token (possibly a full word or synonym) back to a canonical unit symbol. This is used by parseLocalized helpers. Returns null if no mapping is found. Resolves a localized token (full word or synonym) back to a canonical unit symbol. Returns null if no mapping is found.
trackBytes(Stream<List<int>> source, {ProgressCallback? onProgress, Duration sample = const Duration(seconds: 1), ByteConverter? total, bool emitImmediate = true}) Stream<List<int>>
Wraps a byte stream and periodically reports throughput statistics.

Typedefs

ProgressCallback = void Function(StreamProgress)
Callback for reporting stream progress samples.