I have a TempFile
object that is a zip file, and I wish to read from it as follows:
Zip::ZipFile.open_buffer(tempfile) do |zipfile|
...
end
However, when I do this, I get the following error:
Zip::ZipFile.open_buffer expects an argument of class String or IO. Found: Tempfile
I've also tried
Zip::ZipFile.open(tempfile.path) do |zipfile|
...
end
But that returns
can't dup NilClass
How can I process a temporary zip file?
See the following article http://info.michael-simons.eu/2008/01/21/using-rubyzip-to-create-zip-files-on-the-fly/ which explains how to use the more basic interface Zip::ZipOutputStream if you work with a Tempfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With