Sha256: 94998eda42edd1dc9a44cc4db9b85cb4df7648652c54f7f4be6fff6ac776c7e8

Contents?: true

Size: 886 Bytes

Versions: 53

Compression:

Stored size: 886 Bytes

Contents

module Fluent::Plugin
  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

53 entries across 53 versions & 3 rubygems

Version Path
fluent-plugin-s3-1.8.3 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.8.2 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.8.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.8.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.7.2 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.7.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.7.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.6.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.6.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.5.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.5.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-file-inclusion-1.4.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.4.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.3.4 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.3.3 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.3.2 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.3.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.3.0 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.2.1 lib/fluent/plugin/s3_extractor_lzma2.rb
fluent-plugin-s3-1.2.0 lib/fluent/plugin/s3_extractor_lzma2.rb