snappy

所属分类:collect
开发工具:Crystal
文件大小:0KB
下载次数:0
上传日期:2021-03-25 06:36:12
上 传 者sh-1993
说明:  Crystal的Snappy压缩格式读取器编写器,
(Snappy compression format reader writer for Crystal,)

文件列表:
.editorconfig (150, 2021-03-24)
LICENSE (1076, 2021-03-24)
shard.yml (191, 2021-03-24)
spec/ (0, 2021-03-24)
spec/snappy_spec.cr (9379, 2021-03-24)
spec/spec_helper.cr (2817, 2021-03-24)
spec/testdata/ (0, 2021-03-24)
spec/testdata/alice29.txt (148481, 2021-03-24)
spec/testdata/asyoulik.txt (125179, 2021-03-24)
spec/testdata/cp.html (24603, 2021-03-24)
spec/testdata/fields.c (11150, 2021-03-24)
spec/testdata/geo.protodata (118588, 2021-03-24)
spec/testdata/grammar.lsp (3721, 2021-03-24)
spec/testdata/house.jpg (126958, 2021-03-24)
spec/testdata/html (102400, 2021-03-24)
spec/testdata/html_x_4 (409600, 2021-03-24)
spec/testdata/kennedy.xls (1029744, 2021-03-24)
spec/testdata/kppkn.gtb (184320, 2021-03-24)
spec/testdata/lcet10.txt (419235, 2021-03-24)
spec/testdata/mapreduce-osdi-1.pdf (94330, 2021-03-24)
spec/testdata/plrabn12.txt (471162, 2021-03-24)
spec/testdata/ptt5 (513216, 2021-03-24)
spec/testdata/sum (38240, 2021-03-24)
spec/testdata/urls.10K (702087, 2021-03-24)
spec/testdata/xargs.1 (4227, 2021-03-24)
src/ (0, 2021-03-24)
src/snappy.cr (885, 2021-03-24)
src/snappy/ (0, 2021-03-24)
src/snappy/compressor.cr (19167, 2021-03-24)
src/snappy/crc32c.cr (29008, 2021-03-24)
src/snappy/decompressor.cr (14407, 2021-03-24)
src/snappy/reader.cr (6871, 2021-03-24)
src/snappy/snappy.cr (4254, 2021-03-24)
src/snappy/utils.cr (1811, 2021-03-24)
src/snappy/writer.cr (5237, 2021-03-24)
... ...

# Crystal Snappy ![CI](https://github.com/naqvis/snappy/workflows/CI/badge.svg) [![GitHub release](https://img.shields.io/github/release/naqvis/snappy.svg)](https://github.com/naqvis/snappy/releases) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://naqvis.github.io/snappy/) **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). ## Installation 1. Add the dependency to your `shard.yml`: ```yaml dependencies: snappy: github: naqvis/snappy ``` 2. Run `shards install` ## Usage ```crystal require "snappy" ``` Module 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. ## Example: decompress a snappy file # ```crystal require "snappy" File.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]) string = File.open("file.sz") do |file| Compress::Snappy::Reader.open(file) do |sz| sz.gets_to_end end end string # => "abcd" ``` ## Example: compress a file to snappy format # ```crystal require "snappy" File.write("file.txt", "abcd") File.open("./file.txt", "r") do |input_file| File.open("./file.sz", "w") do |output_file| Compress::Snappy::Writer.open(output_file) do |sz| IO.copy(input_file, sz) end end end ``` Refer to **specs** for usage examples. ## Development To run all tests: ``` crystal spec ``` ## Contributing 1. Fork it () 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request ## Contributors - [Ali Naqvi](https://github.com/naqvis) - creator and maintainer

近期下载者

相关文件


收藏者