Module: Datadog::Core::Utils::Compression Deprecated

Defined in:
lib/datadog/core/utils/compression.rb

Overview

Deprecated.

This is no longer used by ddtrace and will be removed in 2.0.

Compression/decompression utility functions.

Class Method Summary collapse

Class Method Details

.gunzip(string, encoding = ::Encoding::ASCII_8BIT) ⇒ Object

Deprecated.

This is no longer used by ddtrace and will be removed in 2.0.



26
27
28
29
30
31
32
# File 'lib/datadog/core/utils/compression.rb', line 26

def gunzip(string, encoding = ::Encoding::ASCII_8BIT)
  sio = StringIO.new(string)
  gz = Zlib::GzipReader.new(sio, encoding: encoding)
  gz.read
ensure
  gz && gz.close
end

.gzip(string, level: nil, strategy: nil) ⇒ Object

Deprecated.

This is no longer used by ddtrace and will be removed in 2.0.



16
17
18
19
20
21
22
23
# File 'lib/datadog/core/utils/compression.rb', line 16

def gzip(string, level: nil, strategy: nil)
  sio = StringIO.new
  sio.binmode
  gz = Zlib::GzipWriter.new(sio, level, strategy)
  gz.write(string)
  gz.close
  sio.string
end