{"id":13482710,"url":"https://github.com/naqvis/snappy","last_synced_at":"2025-05-12T21:59:27.485Z","repository":{"id":88081922,"uuid":"210358407","full_name":"naqvis/snappy","owner":"naqvis","description":"Snappy compression format reader/writer for Crystal","archived":false,"fork":false,"pushed_at":"2021-03-25T06:36:12.000Z","size":1320,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T18:40:04.077Z","etag":null,"topics":["compression-format","crystal","crystal-lang","crystal-language","snappy"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","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/naqvis.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}},"created_at":"2019-09-23T13:10:50.000Z","updated_at":"2024-02-08T09:05:18.000Z","dependencies_parsed_at":"2023-05-18T05:00:23.051Z","dependency_job_id":null,"html_url":"https://github.com/naqvis/snappy","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvis%2Fsnappy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvis%2Fsnappy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvis%2Fsnappy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naqvis%2Fsnappy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naqvis","download_url":"https://codeload.github.com/naqvis/snappy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830913,"owners_count":21971001,"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-format","crystal","crystal-lang","crystal-language","snappy"],"created_at":"2024-07-31T17:01:04.739Z","updated_at":"2025-05-12T21:59:27.466Z","avatar_url":"https://github.com/naqvis.png","language":"Crystal","funding_links":[],"categories":["Compression"],"sub_categories":[],"readme":"# Crystal Snappy\n![CI](https://github.com/naqvis/snappy/workflows/CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/naqvis/snappy.svg)](https://github.com/naqvis/snappy/releases)\n[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://naqvis.github.io/snappy/)\n\n**Pure Crystal** implementation of [Snappy](https://github.com/google/snappy) compression format. This implementation supports more common case [Snappy Framing Format](https://github.com/google/snappy/blob/master/framing_format.txt).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     snappy:\n       github: naqvis/snappy\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"snappy\"\n```\n\nModule provides both `Compress::Snappy::Reader` and `Compress::Snappy::Writer` for use with streams like `IO` and/or files. It also provides `Compress::Snappy#decode` and `Compress::Snappy#encode` for uncompressing and compressing block formats.\n\n## Example: decompress a snappy file\n#\n```crystal\nrequire \"snappy\"\n\nFile.write(\"file.sz\", Bytes[255, 6, 0, 0, 115, 78, 97, 80, 112, 89, 1, 8, 0, 0, 104, 16, 130, 162, 97, 98, 99, 100])\n\nstring = File.open(\"file.sz\") do |file|\n   Compress::Snappy::Reader.open(file) do |sz|\n     sz.gets_to_end\n   end\nend\nstring # =\u003e \"abcd\"\n```\n## Example: compress a file to snappy format\n#\n```crystal\nrequire \"snappy\"\n\nFile.write(\"file.txt\", \"abcd\")\n\nFile.open(\"./file.txt\", \"r\") do |input_file|\n  File.open(\"./file.sz\", \"w\") do |output_file|\n    Compress::Snappy::Writer.open(output_file) do |sz|\n      IO.copy(input_file, sz)\n    end\n  end\nend\n```\n\nRefer to **specs** for usage examples.\n\n## Development\n\nTo run all tests:\n\n```\ncrystal spec\n```\n## Contributing\n\n1. Fork it (\u003chttps://github.com/naqvis/snappy/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Ali Naqvi](https://github.com/naqvis) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaqvis%2Fsnappy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaqvis%2Fsnappy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaqvis%2Fsnappy/lists"}