-
-
Notifications
You must be signed in to change notification settings - Fork 6
File.binary?
Daniel Berger edited this page Dec 5, 2022
·
2 revisions
Returns whether or not +file+ is a binary non-image file, i.e. executable, shared object, ect.
Note that this is NOT guaranteed to be 100% accurate. It performs a "best guess" based on a simple test of the first File.blksize
characters, or 4096, whichever is smaller. It simply looks for a double null sequence internally.
Example:
File.binary?('somefile.exe') # => true
File.binary?('somefile.txt') # => false