Sha256: 40d542c8e8c077b981e77dadcb7dc1fb98234f5b5f5b8788a396abd778541ad6

Contents?: true

Size: 887 Bytes

Versions: 7

Compression:

Stored size: 887 Bytes

Contents

module Fluent
  class S3Input
    class LZOExtractor < Extractor
      S3Input.register_extractor('lzo', self)

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

      def configure(conf)
        super
        check_command('lzop', 'LZO')
      end

      def ext
        'lzo'.freeze
      end

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

      def extract(io)
        path = if io.respond_to?(path)
                 io.path
               else
                 temp = Tempfile.new("lzop-temp")
                 temp.write(io.read)
                 temp.close
                 temp.path
               end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fluent-plugin-s3-0.8.2 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.8.1 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.8.0 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.8.0.rc1 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.7.2 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.7.1 lib/fluent/plugin/s3_extractor_lzo.rb
fluent-plugin-s3-0.7.0 lib/fluent/plugin/s3_extractor_lzo.rb