diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-10 23:26:09 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-10 23:26:09 -0400 |
commit | 82dafe047ec701ecd8d62c8088152fe2c4ab1a5d (patch) | |
tree | b230848006cb10f35d2161be8af7f253c98dad84 /README.md | |
parent | 59439a27a8ae5a5a9ed68022b3fe1d080abd7149 (diff) | |
download | zip-crystal-82dafe047ec701ecd8d62c8088152fe2c4ab1a5d.tar.bz2 zip-crystal-82dafe047ec701ecd8d62c8088152fe2c4ab1a5d.zip |
s/entry.read/entry.write/ and add Writers::DirEntry
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -33,16 +33,13 @@ end # create memory io mem_io = MemoryIO.new -# open "/some/other/path/image.png" for writing -File.open("/some/other/path/image.png", "wb") do |file_io| - # read from "foo.zip" - Zip.read("foo.zip") do |zip| - # extract "bar.txt" to mem_io - zip["bar.txt"].read(mem_io) - - # extract "image.png" to file_io - zip["image.png"].read(file_io) - end +# read from "foo.zip" +Zip.read("foo.zip") do |zip| + # extract "bar.txt" to mem_io + zip["bar.txt"].write(mem_io) + + # extract "image.png" to "output-image.png" + zip["image.png"].write("output-image.png") end ``` |