Created
January 23, 2013 10:22
-
-
Save lmars/4604085 to your computer and use it in GitHub Desktop.
Create a CSV in memory then add it to an encrypted zip file
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 'zipruby' | |
require 'csv' | |
csv = CSV.generate do |csv| | |
csv << ['i', '2i'] | |
1.upto(10) do |i| | |
csv << [i, i*2] | |
end | |
end | |
Zip::Archive.open('encrypted_csv.zip', Zip::CREATE) do |zip| | |
zip.add_buffer('nums.csv', csv) | |
zip.encrypt 'password' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment