bail fast on file extensions we recognize as binary

This commit is contained in:
Aman Gupta
2011-11-23 00:32:14 -08:00
parent e445438333
commit 4b9a1c297b
2 changed files with 12 additions and 0 deletions

View File

@@ -90,6 +90,15 @@ module Linguist
@detect_encoding ||= CharlockHolmes::EncodingDetector.new.detect(data) if data
end
# Public: Is the blob binary according to its mime type
#
# Return true or false
def binary_mime_type?
if mime_type = Mime.lookup_mime_type_for(pathname.extname)
mime_type.binary?
end
end
# Public: Is the blob binary?
#
# Return true or false