class Fluent::Plugin::S3Input::LZMA2Extractor

Public Instance Methods

configure(conf) click to toggle source
# File lib/fluent/plugin/s3_extractor_lzma2.rb, line 8
def configure(conf)
  super
  check_command('xz', 'LZMA')
end
content_type() click to toggle source
# File lib/fluent/plugin/s3_extractor_lzma2.rb, line 17
def content_type
  'application/x-xz'.freeze
end
ext() click to toggle source
# File lib/fluent/plugin/s3_extractor_lzma2.rb, line 13
def ext
  'xz'.freeze
end
extract(io) click to toggle source
# File lib/fluent/plugin/s3_extractor_lzma2.rb, line 21
def extract(io)
  path = if io.respond_to?(path)
           io.path
         else
           temp = Tempfile.new("xz-temp")
           temp.write(io.read)
           temp.close
           temp.path
         end

  stdout, succeeded = Open3.capture2("xz #{@command_parameter} #{path}")
  if succeeded
    stdout
  else
    raise "Failed to extract #{path} with xz command."
  end
end