class HTTPX::Plugins::Compression::GZIP::Encoder

  1. lib/httpx/plugins/compression/gzip.rb
Superclass: Object

Methods

Public Instance

  1. deflate

Public Instance methods

deflate (raw, buffer, chunk_size:)
[show source]
   # File lib/httpx/plugins/compression/gzip.rb
18 def deflate(raw, buffer, chunk_size:)
19   gzip = Zlib::GzipWriter.new(self)
20 
21   while (chunk = raw.read(chunk_size))
22     gzip.write(chunk)
23     gzip.flush
24     compressed = compressed_chunk
25     buffer << compressed
26     yield compressed if block_given?
27   end
28 ensure
29   gzip.close
30 end