mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
bail fast on file extensions we recognize as binary
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user