Sha256: a2e436f371d86e7ea93fd9636c566bb403a25b8dc2a67a854906c6bfe36f95a7

Contents?: true

Size: 972 Bytes

Versions: 22

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

require 'stringio'
require 'zlib'

module Datadog
  module Core
    module Utils
      # Compression/decompression utility functions.
      #
      # @deprecated This is no longer used by ddtrace and will be removed in 2.0.
      module Compression
        module_function

        # @deprecated This is no longer used by ddtrace and will be removed in 2.0.
        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

        # @deprecated This is no longer used by ddtrace and will be removed in 2.0.
        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
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/core/utils/compression.rb
ddtrace-1.23.2 lib/datadog/core/utils/compression.rb
ddtrace-1.23.1 lib/datadog/core/utils/compression.rb
ddtrace-1.22.0 lib/datadog/core/utils/compression.rb
ddtrace-1.21.1 lib/datadog/core/utils/compression.rb
ddtrace-1.21.0 lib/datadog/core/utils/compression.rb
ddtrace-1.20.0 lib/datadog/core/utils/compression.rb
ddtrace-1.19.0 lib/datadog/core/utils/compression.rb
ddtrace-1.18.0 lib/datadog/core/utils/compression.rb
ddtrace-1.17.0 lib/datadog/core/utils/compression.rb
ddtrace-1.16.2 lib/datadog/core/utils/compression.rb
ddtrace-1.16.1 lib/datadog/core/utils/compression.rb
ddtrace-1.16.0 lib/datadog/core/utils/compression.rb
ddtrace-1.15.0 lib/datadog/core/utils/compression.rb
ddtrace-1.14.0 lib/datadog/core/utils/compression.rb
ddtrace-1.13.1 lib/datadog/core/utils/compression.rb
ddtrace-1.13.0 lib/datadog/core/utils/compression.rb
ddtrace-1.12.1 lib/datadog/core/utils/compression.rb
ddtrace-1.12.0 lib/datadog/core/utils/compression.rb
ddtrace-1.11.1 lib/datadog/core/utils/compression.rb