ruby on rails - Streaming-download a gzipped file from s3 and unzip it? -
I was trying to use a jizip file using the AWS-SDK from the S3 bucket and then the file was zlib Wanted to open using.
My code for this part is:
File.open ('app / assets / data.xml.gz', 'wb'). File | Bucket.bags ['linkshare_temp / data.gz']. Read | Chuck | | File.write (flywheel) Ending Zlib :: GzipReader.open ('app / assets / data.gz', 'rb'). Gz | File.new ("data.xml", "w"). G. IO.copy_stream (gz, g) end and
this gives me this error:
Zlib :: GzipFile :: Error: Not in gzip format
The file was downloaded from s3 to my local disk. I can see the file with the correct name and "xml.gz" suffix in my local folder, but for some reason I can not open that file. I think there is something wrong with my code to download from s3.
Thanks in advance.
Comments
Post a Comment