{"id":23680112,"url":"https://github.com/errornointernet/hsize","last_synced_at":"2026-03-01T12:32:28.323Z","repository":{"id":124151264,"uuid":"568834314","full_name":"ErrorNoInternet/hsize","owner":"ErrorNoInternet","description":"Convert file sizes to and from human-readable units","archived":false,"fork":false,"pushed_at":"2026-02-02T14:59:54.000Z","size":535,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-03T03:43:22.286Z","etag":null,"topics":["converter","file-sizes","human-size","humanize","regex","utility"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ErrorNoInternet.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-21T14:06:04.000Z","updated_at":"2026-02-02T15:01:51.000Z","dependencies_parsed_at":"2026-01-03T09:02:12.805Z","dependency_job_id":null,"html_url":"https://github.com/ErrorNoInternet/hsize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ErrorNoInternet/hsize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErrorNoInternet%2Fhsize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErrorNoInternet%2Fhsize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErrorNoInternet%2Fhsize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErrorNoInternet%2Fhsize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ErrorNoInternet","download_url":"https://codeload.github.com/ErrorNoInternet/hsize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErrorNoInternet%2Fhsize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"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":["converter","file-sizes","human-size","humanize","regex","utility"],"created_at":"2024-12-29T17:57:56.278Z","updated_at":"2026-03-01T12:32:28.303Z","avatar_url":"https://github.com/ErrorNoInternet.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hsize\n\nConvert file sizes to and from human-readable units\n\n```sh\n$ hsize 1000 1000000 5000000\n1.0 KB\n1.0 MB\n5.0 MB\n\n$ hsize -p5 1048576 12345678\n1.04858 MB\n12.34568 MB\n\n$ hsize 1048576 1073741824 --binary --no-b-suffix\n1.0 Mi\n1.0 Gi\n```\n\n### Read from stdin\n\n```sh\n$ printf \"10\\n1000\\n1000000000\" | hsize -p 0\n10 B\n1 KB\n1 GB\n\n$ echo $RANDOM | hsize\n26.1 KB\n\n$ printf \"5\\n84\\n\" | hsize -f g -t m\n5000.0 MB\n84000.0 MB\n\n$ echo \"200  512  1\" | hsize -f g -t b -B replace\n214748364800.0 B  549755813888.0 B  1073741824.0 B\n```\n\n### Replace\n\nUse regex to search and replace numbers\n\n```sh\n$ echo \"1  22  333  4444  55555  666666  7777777  88888888  999999999\" | hsize replace\n1.0 B  22.0 B  333.0 B  4.4 KB  55.6 KB  666.7 KB  7.8 MB  88.9 MB  1000.0 MB\n\n$ cat /proc/meminfo | tr -d ' ' | sed \"s/kB//\" | hsize -p 2 -f k replace -r \"\\d+$\" | column -ts :\nMemTotal         16.31 GB\nMemFree          929.67 MB\nMemAvailable     10.87 GB\nBuffers          44.00 KB\nCached           10.71 GB\nSwapCached       6.38 MB\nActive           5.52 GB\nInactive         8.10 GB\nActive(anon)     3.59 GB\nInactive(anon)   214.04 MB\nActive(file)     1.93 GB\nInactive(file)   7.88 GB\nUnevictable      329.73 MB\nMlocked          120.00 KB\nSwapTotal        32.61 GB\n[...]\n\n$ stat flake.nix | hsize -bp2 replace -r\"Size: (\\d+).*IO Block: (\\d+)\"\n  File: flake.nix\n  Size: 1.77 KiB      \tBlocks: 8          IO Block: 4.00 KiB   regular file\nDevice: 0,68\tInode: 2522344     Links: 1\n[...]\n```\n\n## Usage\n\n### Binary\n\n#### Nix\n\n```shell\n$ nix run github:ErrorNoInternet/hsize -- 1000 1000000 5000000\n```\n\n#### Cargo\n\n```shell\n$ cargo +nightly install --git https://github.com/ErrorNoInternet/hsize\n```\n\n### Library\n\n```rust\nuse hsize::{format::Options, Converter, Scale, Unit};\n\nfn main() {\n    let converter = Converter {\n        from_unit: Unit {\n            // 1K = 1000\n            is_binary: false,\n            // `None` for byte (Scale::B)\n            scale: Some(Scale::K),\n        },\n        to_unit: Unit {\n            // 1K = 1024\n            is_binary: true,\n            // `None` for automatic scaling\n            scale: None,\n        },\n    };\n\n    // 1073741824 KB = 1000 GiB\n    assert_eq!(converter.convert(1073741824), (1000.0, Scale::G));\n    assert_eq!(converter.format(1073741824, 3), \"1000.000 GiB\");\n    assert_eq!(\n        converter.format_with_options(\n            1073741824,\n            \u0026Options {\n                precision: 0,\n                separator: \"\",\n                ..Options::default()\n            }\n        ),\n        \"1000GiB\"\n    );\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferrornointernet%2Fhsize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferrornointernet%2Fhsize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferrornointernet%2Fhsize/lists"}