{"id":19138367,"url":"https://github.com/rochet2/lualzw","last_synced_at":"2025-07-23T14:36:14.569Z","repository":{"id":41086356,"uuid":"71663146","full_name":"Rochet2/lualzw","owner":"Rochet2","description":"A relatively fast LZW compression algorithm in pure lua","archived":false,"fork":false,"pushed_at":"2022-12-23T23:37:45.000Z","size":10,"stargazers_count":59,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T20:53:54.327Z","etag":null,"topics":["compression","encoding","lossless","lua","lzw-compression"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/Rochet2.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}},"created_at":"2016-10-22T20:12:51.000Z","updated_at":"2025-05-04T22:24:45.000Z","dependencies_parsed_at":"2023-01-30T19:46:04.277Z","dependency_job_id":null,"html_url":"https://github.com/Rochet2/lualzw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rochet2/lualzw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rochet2%2Flualzw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rochet2%2Flualzw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rochet2%2Flualzw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rochet2%2Flualzw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rochet2","download_url":"https://codeload.github.com/Rochet2/lualzw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rochet2%2Flualzw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266694766,"owners_count":23969827,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["compression","encoding","lossless","lua","lzw-compression"],"created_at":"2024-11-09T06:42:45.326Z","updated_at":"2025-07-23T14:36:14.539Z","avatar_url":"https://github.com/Rochet2.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lualzw\nA relatively fast LZW compression algorithm in pure lua\n\n# encoding and decoding\nLossless compression for any text. The more repetition in the text, the better.\n\n16 bit encoding is used. So each 8 bit character is encoded as 16 bit.\nThis means that the dictionary size is 65280.\n\nAny special characters like `äöå` that are represented with multiple characters are supported. The special characters are split up into single characters that are then encoded and decoded. \n\nWhile compressing, the algorithm checks if the result size gets over the input. If it does, then the input is not compressed and the algorithm returns the input prematurely as the compressed result.\n\nThe `zeros` branch contains a version that does not add additional null `\\0` characters to the input when encoding. Any existing null characters in input string are preserved as nulls however so make sure your input does not contain nulls.\n\n# usage\n```lua\nlocal lualzw = require(\"lualzw\")\n\nlocal input = \"foofoofoofoofoofoofoofoofoo\"\nlocal compressed = assert(lualzw.compress(input))\nlocal decompressed = assert(lualzw.decompress(compressed))\nassert(input == decompressed)\n```\n\n# errors\nReturns nil and an error message when the algorithm fails to compress or decompress.\n\n# speed\nTimes are in seconds.\nBoth have the same generated input.\nThe values are an average of 10 tries.\n\nNote that compressing random generated inputs results usually in bigger result than original. In these cases the algorithms do not compress and return input instead and thus compression result is 100% of input.\n\nlualzw is at an advantage in cases where compression cannot be done as it stops prematurely and LibCompress does not.\nAlso lualzw is at an advantage in cases where compression can be done as it has a larger dictionary in use.\n\nInput: 1000000 random generated bytes converted into string\n\nalgorithm|compress|decompress|result % of input\n---------|--------|----------|-------------\nlualzw|0.6622|0.0003|100\nLibCompress|2.1983|0.0024|100\n\nInput: 1000000 random generated bytes in ASCII range converted into string\n\nalgorithm|compress|decompress|result % of input\n---------|--------|----------|-------------\nlualzw|0.812|0.0022|100\nLibCompress|1.782|0.0007|100\n\nInput: 1000000 random generated repeating bytes converted into string\n\nalgorithm|compress|decompress|result % of input\n---------|--------|----------|-------------\nlualzw|0.3975|0.0262|4.5001\nLibCompress|0.3907|0.0264|6.6997\n\nInput: 1000000 of same character\n\nalgorithm|compress|decompress|result % of input\n---------|--------|----------|-------------\nlualzw|0.7045|0.0026|0.2829\nLibCompress|0.6418|0.0038|0.4241\n\nInput: \"ymn32h8hm8ekrwjkrn9f\" repeated 50000 times. In total 1000000 bytes\n\nalgorithm|compress|decompress|result % of input\n---------|--------|----------|-------------\nlualzw|0.4788|0.0088|1.2629\nLibCompress|0.4426|0.0093|1.8905\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochet2%2Flualzw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frochet2%2Flualzw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochet2%2Flualzw/lists"}