diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-06 12:55:52 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-06 12:55:52 -0400 |
commit | 0584c5d628f34b5d2edb2a075774e0d457423bd2 (patch) | |
tree | d195ea19ed775d54264b57a2fa34e077d90d78b4 /src | |
parent | 15c29c1cd019be5689e0f5ded3b0d94e677c3060 (diff) | |
download | zip-crystal-0584c5d628f34b5d2edb2a075774e0d457423bd2.tar.bz2 zip-crystal-0584c5d628f34b5d2edb2a075774e0d457423bd2.zip |
add variants
Diffstat (limited to 'src')
-rw-r--r-- | src/zip.cr | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -516,6 +516,28 @@ module Zip @pos - src_pos end + def add( + path : String, + body : String | Bytes, + method : CompressionMethod = CompressionMethod::DEFLATE, + time : Time = Time.now, + comment : String = "", + ) : UInt64 + add(path, MemoryIO.new(body), method, time, comment) + end + + def add_file( + path : String, + file_path : String, + method : CompressionMethod = CompressionMethod::DEFLATE, + time : Time = Time.now, + comment : String = "", + ) : UInt64 + File.open(file_path, "rb") do |io| + add(path, io, method, time, comment) + end + end + # 4.3.16 End of central directory record: # # end of central dir signature 4 bytes (0x06054b50) |