aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-10 18:22:10 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-10 18:22:10 -0400
commit5b2aa6bc1efe8e9c36157f1f28cae9191343059b (patch)
treea1291704221595f884ae3c53adb306a2966560ee
parent9787bfe98af7ec407dbcaa1f00c0aef322255ec2 (diff)
downloadzip-crystal-5b2aa6bc1efe8e9c36157f1f28cae9191343059b.tar.bz2
zip-crystal-5b2aa6bc1efe8e9c36157f1f28cae9191343059b.zip
add Entry#size
-rw-r--r--src/zip.cr14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/zip.cr b/src/zip.cr
index aa9006d..1dd666f 100644
--- a/src/zip.cr
+++ b/src/zip.cr
@@ -1257,8 +1257,20 @@ module Zip
# close data memory io
data_mem_io.close
+ end
- nil
+ #
+ # Return the uncompressed size of this entry in bytes.
+ #
+ # Example:
+ #
+ # Zip.read("foo.zip") do |zip|
+ # size = zip["bar.txt"].size
+ # puts "bar.txt is #{size} bytes."
+ # end
+ #
+ def size : UInt32
+ @uncompressed_size
end
# :nodoc: