Skip to content

Commit 75ec995

Browse files
authored
add an example of reading data from pipe (#7)
1 parent f178df6 commit 75ec995

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/src/examples.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ open(GzipDecompressionStream, "data.txt.gz") do stream
2828
end
2929
```
3030

31+
Read compressed data from a pipe
32+
--------------------------------
33+
34+
The input is not limited to usual files. You can read data from a pipe
35+
(actually, any `IO` object that implements basic I/O methods) as follows:
36+
```julia
37+
using CodecZlib
38+
pipe, proc = open(`cat some.data.gz`)
39+
stream = GzipDecompressionStream(pipe)
40+
for line in eachline(stream)
41+
# do something...
42+
end
43+
close(stream) # This will finish the process as well.
44+
```
45+
3146
Save a data matrix with Zstd compression
3247
----------------------------------------
3348

0 commit comments

Comments
 (0)