Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7364

Uncompession of DEFLATE stream by chunks

Newsgroups comp.lang.ruby
Date 2017-07-15 08:55 -0700
Message-ID <fecd0324-a6a0-4278-a2bc-e36aa066498b@googlegroups.com> (permalink)
Subject Uncompession of DEFLATE stream by chunks
From romeeras@gmail.com

Show all headers | View raw


I'm trying to decompress DEFLATE stream in Ruby by using chunks.
From what I see in documentation at http://ruby-doc.org/stdlib-2.4.0/libdoc/zlib/rdoc/Zlib/Inflate.html I must read whole stream into memory before unpacking with inflate:

open "compressed.file" do |compressed_io|
  zi = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)

  begin
    open "uncompressed.file", "w+" do |uncompressed_io|
      uncompressed_io << zi.inflate(compressed_io.read)
    end
  ensure
    zi.close
  end
end

Do you know way to decode Deflate stream by chunks? Can I do this with Zlib::Inflate or I should use zlib functions directly?

Back to comp.lang.ruby | Previous | Next | Find similar


Thread

Uncompession of DEFLATE stream by chunks romeeras@gmail.com - 2017-07-15 08:55 -0700

csiph-web