Skip to content

Commit 17dabbb

Browse files
committed
Update documentation
1 parent e6dfca8 commit 17dabbb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ res << stream.compress("def")
6666
res << stream.finish
6767
```
6868

69+
### Streaming Compression using Dictionary
70+
```ruby
71+
stream = Zstd::StreamingCompress.new(dict: IO.read('dictionary_file'))
72+
stream << "abc" << "def"
73+
res = stream.flush
74+
stream << "ghi"
75+
res << stream.finish
76+
```
77+
6978
### Simple Decompression
7079

7180
```ruby
@@ -87,6 +96,15 @@ result << stream.decompress(cstr[0, 10])
8796
result << stream.decompress(cstr[10..-1])
8897
```
8998

99+
### Streaming Decompression using dictionary
100+
```ruby
101+
cstr = "" # Compressed data
102+
stream = Zstd::StreamingDecompress.new(dict: IO.read('dictionary_file'))
103+
result = ''
104+
result << stream.decompress(cstr[0, 10])
105+
result << stream.decompress(cstr[10..-1])
106+
```
107+
90108
### Skippable frame
91109

92110
```ruby

0 commit comments

Comments
 (0)