How to read the xxx.gz file directly and don't decompress the file.
Thanks.
···
--
Posted via http://www.ruby-forum.com/.
How to read the xxx.gz file directly and don't decompress the file.
Thanks.
--
Posted via http://www.ruby-forum.com/.
http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/classes/Zlib/GzipReader.html
Cheers
robert
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen <dickyhide@gmail.com> wrote:
How to read the xxx.gz file directly and don't decompress the file.
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
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 }
--
Posted via http://www.ruby-forum.com/\.
Robert Klemme wrote in post #1020184:
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen <dickyhide@gmail.com> 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 gem should I install first??
Thanks,
--
Posted via http://www.ruby-forum.com/\.
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'
On Sep 6, 2011, at 8:32 PM, CC Chen wrote:
Robert Klemme wrote in post #1020184:
On Mon, Sep 5, 2011 at 10:45 AM, CC Chen <dickyhide@gmail.com> 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??