Sha256: 95b2a8a1c40988b33fcce65a4268f59677aebf952800750f57e0ec587bc0e6d4

Contents?: true

Size: 303 Bytes

Versions: 12

Compression:

Stored size: 303 Bytes

Contents

module Excavate
  class FileMagic
    def self.detect(path)
      new(path).detect
    end

    def initialize(path)
      @path = path
    end

    def detect
      case File.read(@path, 8, mode: "rb")
      when "MSCF\x00\x00\x00\x00".force_encoding("BINARY")
        :cab
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
excavate-0.3.3 lib/excavate/file_magic.rb
excavate-0.3.2 lib/excavate/file_magic.rb
excavate-0.3.1 lib/excavate/file_magic.rb
excavate-0.3.0 lib/excavate/file_magic.rb
excavate-0.2.5 lib/excavate/file_magic.rb
excavate-0.2.4 lib/excavate/file_magic.rb
excavate-0.2.3 lib/excavate/file_magic.rb
excavate-0.2.2 lib/excavate/file_magic.rb
excavate-0.2.1 lib/excavate/file_magic.rb
excavate-0.2.0 lib/excavate/file_magic.rb
excavate-0.1.1 lib/excavate/file_magic.rb
excavate-0.1.0 lib/excavate/file_magic.rb