{"id":51509502,"url":"https://github.com/murphsicles/zstd","last_synced_at":"2026-07-08T04:30:57.114Z","repository":{"id":361082767,"uuid":"1253027394","full_name":"murphsicles/zstd","owner":"murphsicles","description":"@compress/zstd — Zeta port of zstd v1.5.7","archived":false,"fork":false,"pushed_at":"2026-05-29T05:34:21.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T07:09:41.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/murphsicles.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":"2026-05-29T05:02:49.000Z","updated_at":"2026-05-29T05:34:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/murphsicles/zstd","commit_stats":null,"previous_names":["murphsicles/zstd"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/murphsicles/zstd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fzstd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fzstd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fzstd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fzstd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/murphsicles","download_url":"https://codeload.github.com/murphsicles/zstd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fzstd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35252324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"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":"2026-07-08T04:30:56.294Z","updated_at":"2026-07-08T04:30:57.109Z","avatar_url":"https://github.com/murphsicles.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# zstd\n\n[![Zeta](https://img.shields.io/badge/Zeta-Language-%23FF6B6B?style=flat-square)](https://zeta-lang.org)\n[![zorbs.io](https://img.shields.io/badge/zorbs.io-@compress/zstd-%2300C4FF?style=flat-square)](https://zorbs.io/@compress/zstd)\n[![GitHub](https://img.shields.io/badge/GitHub-murphsicles/zstd-%23181717?style=flat-square)](https://github.com/murphsicles/zstd)\n\nFast streaming compression for Zeta. Zstd provides real-time compression and decompression using the Zstandard algorithm — offering higher compression ratios than gzip with faster decompression speeds.\n\n## Quick Start\n\nAdd to your `zorb.toml`:\n\n```toml\n[dependencies]\n@compress/zstd = \"1.0\"\n```\n\nCompress and decompress data:\n\n```zeta\nuse @compress/zstd::{encode_all, decode_all};\nuse std::io::Cursor;\n\nfn main() {\n    let input: [u8; 1000] = [42; 1000]; // 1000 bytes of data\n\n    // Compress with default compression level\n    let compressed = encode_all(Cursor(input), DEFAULT_COMPRESSION_LEVEL).unwrap();\n    print(\"Compressed: {} bytes → {} bytes\\n\", input.len, compressed.len);\n\n    // Decompress back\n    let decompressed = decode_all(Cursor(compressed)).unwrap();\n    print(\"Decompressed: {} bytes\\n\", decompressed.len);\n}\n```\n\n## Streaming API\n\nUse `Encoder` and `Decoder` for streaming compression of large data:\n\n```zeta\nuse @compress/zstd::stream::{Encoder, Decoder};\nuse std::io::{Read, Write, Cursor};\n\nfn main() {\n    // Streaming encode\n    let mut encoder = Encoder::new(Vec\u003cu8\u003e(), 3).unwrap(); // Level 3\n    encoder.write_all(my_data).unwrap();\n    let compressed = encoder.finish().unwrap();\n\n    // Streaming decode\n    let mut decoder = Decoder::new(Cursor(compressed)).unwrap();\n    let mut decompressed = Vec::new();\n    decoder.read_to_end(\u0026mut decompressed).unwrap();\n}\n```\n\n## Bulk API\n\nFor one-shot compression where you already have all the data in memory:\n\n```zeta\nuse @compress/zstd::bulk::{compress, decompress};\n\nfn main() {\n    let compressed = compress(my_data, DEFAULT_COMPRESSION_LEVEL).unwrap();\n    let recovered = decompress(compressed, my_data.len()).unwrap();\n}\n```\n\n## Compression Levels\n\n| Level | Range | Typical Use |\n|-------|-------|-------------|\n| 1 | Fastest | Real-time, low CPU budget |\n| 3 | Default | Good balance (general purpose) |\n| 6–9 | Higher | Archival, smaller output |\n| 10–22 | Ultra | Maximum compression (slow) |\n\n```zeta\n// Check available range\nlet (min, max) = compression_level_range();\nprint(\"Levels {} to {} are supported\\n\", min, max);\n```\n\n## Dictionary Compression\n\nFor small-data workloads (records, configs), pre-trained dictionaries improve compression ratios significantly:\n\n```zeta\nuse @compress/zstd::dict::{EncoderDictionary, DecoderDictionary};\n\nfn main() {\n    let dict_data = train_dictionary(samples);\n    let enc_dict = EncoderDictionary::new(dict_data, 3);\n    let dec_dict = DecoderDictionary::new(dict_data);\n\n    let compressed = encode_all_with_dict(data, enc_dict).unwrap();\n    let recovered = decode_all_with_dict(compressed, dec_dict).unwrap();\n}\n```\n\n## API Overview\n\n| Function / Type | Description |\n|----------------|-------------|\n| `encode_all(input, level)` | One-shot compress everything |\n| `decode_all(input)` | One-shot decompress everything |\n| `Encoder` | Streaming compressor (implements `Write`) |\n| `Decoder` | Streaming decompressor (implements `Read`) |\n| `DEFAULT_COMPRESSION_LEVEL` | Default level (3) |\n| `compression_level_range()` | Returns `(min, max)` supported levels |\n| `bulk::compress(data, level)` | Bulk in-memory compression |\n| `bulk::decompress(data, capacity)` | Bulk in-memory decompression |\n| `dict` | Dictionary training and encoding |\n\n## Tips\n\n- For network streams, use `Encoder`/`Decoder` (streaming) — not `encode_all`\n- If you're compressing a file on disk, use `Encoder` wrapping a `BufWriter`\n- Bulk API is faster than streaming when you already have the full buffer\n- Compression level 3 is the default for good reason — levels above 6 give diminishing returns on most data\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Fzstd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurphsicles%2Fzstd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Fzstd/lists"}