from ptools.
from ptools
Returns:
3 4 5 6
# File 'lib/fission/core_ext/file.rb', line 3 def self.binary?(file) s = (File.read(file, File.stat(file).blksize) || "").split(//) ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30 end