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?
It turns out that the temporary file was corrupted, so the
error was as a result of trying to read the corrupted file.
Therefore the solution is to use