@@ -46,7 +46,7 @@ compressed_data = Zstd.compress(data, level: complession_level) # default compre
46
46
#### Compression with Dictionary
47
47
``` ruby
48
48
# dictionary is supposed to have been created using `zstd --train`
49
- compressed_using_dict = Zstd .compress(" " , dict: IO .read(' dictionary_file' ))
49
+ compressed_using_dict = Zstd .compress(" " , dict: File .read(' dictionary_file' ))
50
50
```
51
51
52
52
#### Streaming Compression
@@ -70,7 +70,7 @@ res << stream.finish
70
70
71
71
#### Streaming Compression with Dictionary
72
72
``` ruby
73
- stream = Zstd ::StreamingCompress .new (dict: IO .read(' dictionary_file' ))
73
+ stream = Zstd ::StreamingCompress .new (dict: File .read(' dictionary_file' ))
74
74
stream << " abc" << " def"
75
75
res = stream.flush
76
76
stream << " ghi"
@@ -79,7 +79,7 @@ res << stream.finish
79
79
80
80
#### Streaming Compression with level and Dictionary
81
81
``` ruby
82
- stream = Zstd ::StreamingCompress .new (level: 5 , dict: IO .read(' dictionary_file' ))
82
+ stream = Zstd ::StreamingCompress .new (level: 5 , dict: File .read(' dictionary_file' ))
83
83
stream << " abc" << " def"
84
84
res = stream.flush
85
85
stream << " ghi"
@@ -97,7 +97,7 @@ data = Zstd.decompress(compressed_data)
97
97
#### Decompression with Dictionary
98
98
``` ruby
99
99
# dictionary is supposed to have been created using `zstd --train`
100
- Zstd .decompress(compressed_using_dict, dict: IO .read(' dictionary_file' ))
100
+ Zstd .decompress(compressed_using_dict, dict: File .read(' dictionary_file' ))
101
101
```
102
102
103
103
#### Streaming Decompression
@@ -112,7 +112,7 @@ result << stream.decompress(cstr[10..-1])
112
112
#### Streaming Decompression with dictionary
113
113
``` ruby
114
114
cstr = " " # Compressed data
115
- stream = Zstd ::StreamingDecompress .new (dict: IO .read(' dictionary_file' ))
115
+ stream = Zstd ::StreamingDecompress .new (dict: File .read(' dictionary_file' ))
116
116
result = ' '
117
117
result << stream.decompress(cstr[0 , 10 ])
118
118
result << stream.decompress(cstr[10 ..- 1 ])
0 commit comments