Module: Datadog::CI::Transport::Gzip
- Defined in:
- lib/datadog/ci/transport/gzip.rb
Class Method Summary collapse
Class Method Details
.compress(input) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/datadog/ci/transport/gzip.rb', line 12 def compress(input) sio = StringIO.new gzip_writer = Zlib::GzipWriter.new(sio, Zlib::DEFAULT_COMPRESSION, Zlib::DEFAULT_STRATEGY) gzip_writer << input gzip_writer.close sio.string end |
.decompress(input) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/ci/transport/gzip.rb', line 20 def decompress(input) sio = StringIO.new(input) gzip_reader = Zlib::GzipReader.new( sio, external_encoding: Encoding::UTF_8, internal_encoding: Encoding::UTF_8 ) gzip_reader.read || "" ensure gzip_reader&.close end |