Created
December 19, 2012 12:50
-
-
Save mechamogera/4336452 to your computer and use it in GitHub Desktop.
ziprubyの暗号化zip圧縮解凍のテストスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'zipruby' | |
outdir = "test" | |
Zip::Archive.open('hoge.zip', Zip::CREATE) do |arc| | |
arc.add_file('test.txt') | |
arc.encrypt('password') | |
end | |
Zip::Archive.open("hoge.zip") do |arc| | |
arc.decrypt('password') | |
arc.num_files.times do |i| | |
arc.fopen(arc.get_name(i)) do |file| | |
File.open(File.join(outdir, file.name), "w") do |f| | |
f.write file.read | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment