How to read the xxx.gz file directly and don’t decompress the file.
Thanks.
How to read the xxx.gz file directly and don’t decompress the file.
Thanks.
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen [email protected] wrote:
How to read the xxx.gz file directly and don’t decompress the file.
http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/classes/Zlib/GzipReader.html
Cheers
robert
On Sep 6, 2011, at 8:32 PM, CC Chen wrote:
Robert K. wrote in post #1020184:
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen [email protected] wrote:
How to read the xxx.gz file directly and don’t decompress the file.
http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/classes/Zlib/GzipReader.html
Which kind gem should I install first??
The Standard Library is libraries that are all included with a Ruby
distribution, but (unlike Core) are not included in the runtime by
default. The only thing you need to do is:
require 'zlib'
Robert K. wrote in post #1020184:
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen [email protected] wrote:
How to read the xxx.gz file directly and don’t decompress the file.
http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/classes/Zlib/GzipReader.html
Cheers
robert
Which kind of gem should I install first??
Thanks,
CC Chen wrote in post #1020179:
How to read the xxx.gz file directly and don’t decompress the file.
You don’t want to decompress the file?
data = File.read(“foo.gz”)
You do want to decompress the file? Use the built-in zlib support:
require ‘zlib’
data = Zlib::GzipReader.open(“foo.gz”) { |f| f.read }
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs