What is sizelib?

sizelib is a Python library for calculating and humanizing file sizes & times. It offers a zero-overhead and highly readable API.

  • Size Helper Functions – Define constraints easily using binary (base 2 / 1024) or decimal (base 10 / 1000) helper methods.
  • Humanizing Byte Sizes – Convert raw byte values back into clean, readable strings using the human_size() function.
  • Time Helper Functions – Define time constraints cleanly in seconds using duration unit methods (ms, s, m, h, d, w).
  • Humanizing Times – Convert raw second values into readable duration strings using the human_time() function.
  • Type Preservation – Dynamically maintains input types (int or float) across all calculations.
  • Zero Overhead & Dependencies – Pure-Python library with zero external dependencies.