{"id":22348985,"url":"https://github.com/vxern/human_file_size","last_synced_at":"2026-02-22T05:33:55.118Z","repository":{"id":255254612,"uuid":"849017905","full_name":"vxern/human_file_size","owner":"vxern","description":"📏 Get a human representation of the size of your files.","archived":false,"fork":false,"pushed_at":"2024-11-23T14:24:43.000Z","size":146,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-22T08:30:30.887Z","etag":null,"topics":["binary","bytes","converter","customizable","dart","decimal","display","file","file-size","flutter","formatter","string","utility"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/human_file_size","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vxern.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-28T20:32:38.000Z","updated_at":"2025-10-12T01:52:41.000Z","dependencies_parsed_at":"2025-07-30T06:31:23.198Z","dependency_job_id":"c2af1314-8f66-45cb-956d-352a64ae221c","html_url":"https://github.com/vxern/human_file_size","commit_stats":null,"previous_names":["vxern/file_size","vxern/human_file_size"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/vxern/human_file_size","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fhuman_file_size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fhuman_file_size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fhuman_file_size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fhuman_file_size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vxern","download_url":"https://codeload.github.com/vxern/human_file_size/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fhuman_file_size/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29705536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","bytes","converter","customizable","dart","decimal","display","file","file-size","flutter","formatter","string","utility"],"created_at":"2024-12-04T11:06:59.211Z","updated_at":"2026-02-22T05:33:55.086Z","avatar_url":"https://github.com/vxern.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A robust, customisable package to get a human representation of the size of your files.\n\n### Usage\n\n`human_file_size` exposes a function `humanFileSize()` and extension method `num.humanFileSize()`.\n\nThe most basic usage is as follows:\n\n```dart\n// 0 bytes, shown in bits\nhumanFileSize(0); // 0 b\n\n// Less than one byte\nhumanFileSize(0.75); // 6 b\n\n// 8 bytes\nhumanFileSize(8); // 8 B\n\n// 1.2 kilobytes in bytes\nhumanFileSize(1000 * 1.2); // 1.2 KB\n\n// 3 gigabytes in bytes\nhumanFileSize(1000 * 1000 * 1000 * 3); // 3 GB\n```\n\nOr, using the extension method:\n```dart\n10.humanFileSize(); // 10 B\n\n51.22.humanFileSize(); // 51.22 B\n\n1234.humanFileSize(); // 1.234 KB\n```\n\nBy default, `humanFileSize()` takes the size to be in bytes (`inputUnit: Unit.byte`). You may specify otherwise by passing a different value for `inputUnit`:\n\n```dart\n// 1000 bytes -\u003e 1 kilobyte\nhumanFileSize(1000); // 1 KB\n\n// 1 kilobit in bits\nhumanFileSize(1000, inputUnit: Unit.bit); // 1 Kb\n\n// 1 megabit in kilobits\nhumanFileSize(1000, inputUnit: Unit.kilobit); // 1 Mb\n```\n\nThe library provides decimal and binary units starting at bit and byte, then following through prefixes kilo-, mega-, giga-, tera-, peta-, exa-, zeta- and yotta-. Custom units are supported.\n\nBy default, `humanFileSize()` converts to the largest unit possible (`unitConversion: const BestFitUnitConversion()`). You may specify otherwise by passing a different value for `unitConversion`:\n\n```dart\n// 1000 bytes -\u003e 1 kilobyte\nhumanFileSize(1000); // 1 Kb\n\n// 1000 bytes -\u003e 8000 bits\nhumanFileSize(\n  1000,\n  unitConversion: SpecificUnitConversion(unit: Unit.bit),\n); // 8000 b\n```\n\nBy default, `humanFileSize()` uses a simple strategy to format the quantity (`quantityDisplayMode: const SimpleQuantityDisplayMode()`). You may specify otherwise by passing a different value to `quantityDisplayMode`:\n\n```dart\n// `SimpleQuantityDisplayMode` is the default mode.\nhumanFileSize(1); // 1 B\n\n// `IntlQuantityDisplayMode` can be used for localisation.\nhumanFileSize(\n  1.234,\n  quantityDisplayMode: IntlQuantityDisplayMode(\n    numberFormat: NumberFormat.decimalPattern('pl'),\n  ),\n); // 1,234 B\n```\n\nYou may also specify the numeral system used when using `BestFitUnitConversion()`. The library has two built-in numeral systems: decimal and binary. To set the numeral system, pass a `numeralSystem` into `BestFitUnitConversion()`:\n\n```dart\n// 1024 bytes -\u003e 1 kibibyte\nhumanFileSize(\n  1024,\n  unitConversion: const BestFitUnitConversion(\n    numeralSystem: BinaryNumeralSystem(),\n  ),\n); // 1 KiB\n```\n\nBy default, `humanFileSize()` converts to the short, uppercase style (`unitStyle: const ShortUppercaseUnitStyle()`). You may specify otherwise by passing a different value to `unitStyle`:\n\n```dart\nhumanFileSize(1, inputUnit: Unit.gigabit); // Gb\n\nhumanFileSize(\n  1,\n  inputUnit: Unit.gigabit,\n  unitStyle: const ShortLowercaseUnitStyle(),\n); // gb\n\nhumanFileSize(\n  1,\n  inputUnit: Unit.gigabit,\n  unitStyle: const LongLowercaseUnitStyle(),\n); // gbit\n\nhumanFileSize(\n  1,\n  inputUnit: Unit.gigabit,\n  unitStyle: const LongUppercaseUnitStyle(),\n); // Gbit\n```\n\nTo specify the method by which to obtain the output format, provide a value for `outputFormatter`. By default, the output format will be `{quantity} {unit}`.\n\n```dart\nhumanFileSize(1); // 1 B\n\nhumanFileSize(\n  1,\n  outputFormatter: const SimpleOutputFormatter(includeSpace: false),\n); // 1B\n\nhumanFileSize(\n  1,\n  outputFormatter: const SimpleOutputFormatter(unitFirst: true),\n); // B 1\n```\n\nThe library is resilient to funky quantities being passed in, with the output unit always being the given `inputUnit`:\n\n```dart\n// Negative sizes\nhumanFileSize(1000 * -2); // -2 KB\n\n// Infinity\nhumanFileSize(double.infinity, inputUnit: Unit.gigabyte); // ∞ GB\n\n// Negative infinity\nhumanFileSize(double.negativeInfinity, inputUnit: Unit.kilobit); // -∞ Kb\n\n// NaN\nhumanFileSize(double.nan, inputUnit: Unit.exabit); // NaN Eb\n```\n\nYou can perform size comparisons:\n\n```dart\nfinal byteCount = BigInt.from(50);\n\nbyteCount \u003e= Unit.kilobit.bytes; // false\n\nbyteCount \u003e= Unit.bit.bytes; // true\n```\n\nFor more information, have a browse through the exposed symbols and through the documentation on each of them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvxern%2Fhuman_file_size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvxern%2Fhuman_file_size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvxern%2Fhuman_file_size/lists"}