I"m aware of:
require 'open-uri'
zipFile = open(URL).read
but this pulls back a string... I need to pull back a zip file
(binary).
Any ideas?
thanks,
phil
I"m aware of:
require 'open-uri'
zipFile = open(URL).read
but this pulls back a string... I need to pull back a zip file
(binary).
Any ideas?
thanks,
phil
Well since you are trying to unzip a ZIP file, I suggest you read about the
Zlib::Inflate class in your documentation.
Start here:
http://www.ruby-doc.org/core/classes/Zlib/Inflate.html
The above page shows this example:
def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end
phil.swenson@gmail.com wrote:
I"m aware of:
require 'open-uri'
zipFile = open(URL).readbut this pulls back a string... I need to pull back a zip file
(binary).Any ideas?
--
Paul Lutus
http://www.arachnoid.com
Isn't Zlib for gzip? I'm trying to access a zip file.
To use ruby Zip for this, but I have a string, not a binary form the
> require 'open-uri'
> zipFile = open(URL).read
code...
not sure how to proceed.
thanks,
phil
Paul Lutus wrote:
phil.swenson@gmail.com wrote:
> I"m aware of:
>
> require 'open-uri'
> zipFile = open(URL).read
>
> but this pulls back a string... I need to pull back a zip file
> (binary).
>
> Any ideas?Well since you are trying to unzip a ZIP file, I suggest you read about the
Zlib::Inflate class in your documentation.Start here:
http://www.ruby-doc.org/core/classes/Zlib/Inflate.html
The above page shows this example:
def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end--
Paul Lutus
http://www.arachnoid.com
The string you have is the content of the zip file. To make it a file
just write it to a file.
File.open(NAME, 'wb') {|f| f.write string}
You may want to try rubyzip.sf.net
I'm not sure but I think gzip and zip files use the same compression.
On 11/16/06, phil.swenson@gmail.com <phil.swenson@gmail.com> wrote:
Isn't Zlib for gzip? I'm trying to access a zip file.
To use ruby Zip for this, but I have a string, not a binary form the
> > require 'open-uri'
> > zipFile = open(URL).readcode...
not sure how to proceed.
thanks,