{"id":20122886,"url":"https://github.com/freaky/compresstimator","last_synced_at":"2025-08-01T14:11:21.584Z","repository":{"id":142942503,"uuid":"193121608","full_name":"Freaky/compresstimator","owner":"Freaky","description":"Simple and fast compressibility tester","archived":false,"fork":false,"pushed_at":"2020-04-24T02:51:10.000Z","size":12,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T16:49:01.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Freaky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-06-21T15:29:14.000Z","updated_at":"2025-03-02T11:53:03.000Z","dependencies_parsed_at":"2023-04-07T07:01:21.957Z","dependency_job_id":null,"html_url":"https://github.com/Freaky/compresstimator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Freaky/compresstimator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fcompresstimator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fcompresstimator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fcompresstimator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fcompresstimator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freaky","download_url":"https://codeload.github.com/Freaky/compresstimator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fcompresstimator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268240911,"owners_count":24218371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-13T19:41:40.020Z","updated_at":"2025-08-01T14:11:21.558Z","avatar_url":"https://github.com/Freaky.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compresstimator\n\n[![Crates.io](https://img.shields.io/crates/v/compresstimator.svg)](https://crates.io/crates/compresstimator)\n\nA simple vaguely statistical file compressibility tester.\n\n## Description\n\n`Compresstimator` is a library for quickly determining the rough compressibility\nof a given file, using linear sampling (i.e. testing every n-th block) and lz4\ncompression.\n\nFor large files this can give a reasonable idea of compressibility with just a\nfew dozen seeks and a few hundred kilobytes of data - usually serviced by even\nslow hard disks in under a second.\n\n## Usage\n\n`Compresstimator` consists of a public type that encapsulates the settings of\nthe estimator - currently just the block size used for sampling.  In future this\nmay also include settings for trading accuracy for speed.\n\nAll estimation functions return an `f32` indicating the compression ratio,\nbetween 0 and 1.\n\n```rust\nuse compresstimator::Compresstimator;\n\n// Create an estimator with the default block size of 4096 bytes\nlet estimator = Compresstimator::new();\n\n// This is usually accurate to within 10-15% for lz4 level 1\nif estimator.compresstimate_file(\"huge_file\")? \u003e 0.95 {\n  \tprintln!(\"Probably doesn't compress well.\");\n}\n\n// If you have the file size, you can avoid a metadata lookup\nlet len = fs::metadata(\"huge_file\")?.len();\nif estimator.compresstimate_file_len(\"huge_file\", len)? \u003e 0.95 {\n  \tprintln!(\"Probably doesn't compress well.\");\n}\n\n// You can also pass in a handle to any Read + Seek\nlet mut f = File::open(\"huge_file\")?;\nif estimator.compresstimate(\u0026mut f, len)? \u003e 0.95 {\n  \tprintln!(\"Probably doesn't compress well.\");\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Fcompresstimator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreaky%2Fcompresstimator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Fcompresstimator/lists"}