class Fluent::Plugin::OSSInput::GzipCommandDecompressor

This class uses gzip command to decompress chunks.

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/oss_decompressor_gzip_command.rb, line 10
def configure(conf)
  super
  check_command('gzip')
end
content_type() click to toggle source
# File lib/fluent/plugin/oss_decompressor_gzip_command.rb, line 19
def content_type
  'application/x-gzip'.freeze
end
decompress(io) click to toggle source
# File lib/fluent/plugin/oss_decompressor_gzip_command.rb, line 23
def decompress(io)
  path = io.path

  out, err, status = Open3.capture3("gzip #{@command_parameter} #{path}")
  if status.success?
    out
  else
    log.warn "failed to execute gzip command, #{err.to_s.gsub("\n",'')}, fallback to GzipReader."

    begin
      io.rewind
      Zlib::GzipReader.wrap(io)
    end
  end
end
ext() click to toggle source
# File lib/fluent/plugin/oss_decompressor_gzip_command.rb, line 15
def ext
  'gz'.freeze
end