Sha256: 52e8b839efb4f773cfc7598fb27743988deedb39c14e233d128187982f9dabd8
Contents?: true
Size: 514 Bytes
Versions: 6
Compression:
Stored size: 514 Bytes
Contents
# -*- coding: utf-8 -*- class File # Detect the file's data type by opening the file then # using IO#magic_number_type to read the first bits. # # Return a magic number type symbol, e.g. :bitmap, :jpg, etc. # # Example: # puts File.magic_number_type("test.ps") => :postscript # # See # - IO#MagicNumberTypeHash # - IO#magic_number_type # def self.magic_number_type(file_name) f = File.open(file_name,"rb") type = f.magic_number_type f.close return type end end
Version data entries
6 entries across 6 versions & 1 rubygems