Sha256: 165cf1eb525e0e8592fa9d940318921b6d74e87309861904f0a9d941fd7c14ef

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

require_relative "provider"

module Ddr
  module FileTools
    class Tika < Provider

      class << self
        # Path to tika-app.jar
        attr_accessor :tika_path
      end

      self.tika_path = File.join(File.expand_path("../../../../bin", __FILE__), "tika-app.jar")

      def text(file_path)
        call command(file_path, "--text")
      end

      def metadata(file_path)
        call command(file_path, "--metadata", "--xml")
      end

      private

      def command(file_path, *options)
        ["java", "-jar", self.class.tika_path, options, file_path].flatten
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddr-filetools-0.4.0 lib/ddr/filetools/tika.rb