Sha256: 47957f9edd09f60a7a8b53d153b1c43ea564d9e219f0f1b689971571585fbd60
Contents?: true
Size: 432 Bytes
Versions: 12
Compression:
Stored size: 432 Bytes
Contents
class File # def self.is_bin?(f) # file_test = %x(file #{f}) # # http://stackoverflow.com/a/8873922 # file_test = file_test.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode('UTF-8', 'UTF-16') # file_test !~ /text/ # end def File.binary? name open name do |f| while (b=f.read(256)) do return true if b[ "\0"] end end false end end
Version data entries
12 entries across 12 versions & 1 rubygems