Sha256: 295cf110eb81f268ea221515c65c1a966a84220f63fe668a05c2ba0b4b8b06f6

Contents?: true

Size: 881 Bytes

Versions: 13

Compression:

Stored size: 881 Bytes

Contents

module Fluent
  class S3Input
    class LZMA2Extractor < Extractor
      S3Input.register_extractor('lzma2', self)

      config_param :command_parameter, :string, :default => '-qdc'

      def configure(conf)
        super
        check_command('xz', 'LZMA')
      end

      def ext
        'xz'.freeze
      end

      def content_type
        'application/x-xz'.freeze
      end

      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
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fluent-plugin-s3-0.8.8 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.7 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.6 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.5 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.4 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.3 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.2 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.8.0.rc1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.7.2 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.7.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-0.7.0 lib/fluent/plugin/s3_extractor_lzma2.rb