{"id":16554715,"url":"https://github.com/owez/rle","last_synced_at":"2025-10-06T01:17:19.288Z","repository":{"id":115272552,"uuid":"317330475","full_name":"Owez/rle","owner":"Owez","description":"A simple run-length-encoding implementation for light compression","archived":false,"fork":false,"pushed_at":"2020-11-30T20:16:47.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-15T06:13:01.352Z","etag":null,"topics":["compression","compression-algorithm","rle","run-length-encoding","rust"],"latest_commit_sha":null,"homepage":"","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/Owez.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}},"created_at":"2020-11-30T19:54:02.000Z","updated_at":"2020-11-30T20:16:49.000Z","dependencies_parsed_at":"2023-03-15T15:15:46.894Z","dependency_job_id":null,"html_url":"https://github.com/Owez/rle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Frle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Frle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Frle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Frle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Owez","download_url":"https://codeload.github.com/Owez/rle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241915328,"owners_count":20041742,"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","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":["compression","compression-algorithm","rle","run-length-encoding","rust"],"created_at":"2024-10-11T19:52:08.830Z","updated_at":"2025-10-06T01:17:14.243Z","avatar_url":"https://github.com/Owez.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Run-length-encoding: `rle`\n\nA simple [run-length-encoding](https://en.wikipedia.org/wiki/Run-length_encoding) implementation for light compression\n\n## Examples\n\nEncoding:\n\n```rust\nuse rle;\n\nfn main() {\n    let data = \u0026[44, 43, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3];\n    let compressed = rle::compress(data);\n\n    println!(\"normal: {}, compressed: {}\", data.len(), compressed.len());\n\n    // will show \"normal: 16, compressed: 10\"\n}\n```\n\n## Under the hood\n\nThis `rle` library uses a custom [run-length-encoding](https://en.wikipedia.org/wiki/Run-length_encoding) technique in order to get the most efficiant compression results. It achieves this by allowing all repeating characters under 6x through, e.g:\n\n```none\nhelllllo!\n```\n\nBut allows anything 6x or above through, e.g:\n\n```none\nhellllllllllllllllllllllllllllllllllllllllllllo!\n```\n\nThis is due to the encoding using a `u32` under the hood to store the length, which means the it can store up to ~4 billion repeating characters until overflow. A run-length-encoded block would look like the following for the previous example:\n\n```none\n[h, e, 4, 0, 0, 0, 44, o, !]\n```\n\nYou may assume whatever binary encoding you'd like for these letters to properly expand this block, but in essense it uses an [End-of-Transmission character](https://en.wikipedia.org/wiki/End-of-Transmission_character) to represent the start of an run-length-encoded block and has a `[u8; 4]` (which represents the previously mentioned `u32` in big-endian form).\n\nAfter that, it simply has a `u8` for the byte it is representing and continued further onwards; looping this compression/decompression until the end of the inputted bytes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowez%2Frle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowez%2Frle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowez%2Frle/lists"}