[Toybox] [PATCH] Implement file(1).

Brad Conroy technosaurus at yahoo.com
Sun Feb 14 21:44:35 PST 2016


I have gathered quite a bit of magic/offset/mime-type data here:
https://github.com/technosaurus/MIMEtype

It does the equivalent of file -m

Basically all of the mime types with magic at offset 0 (most
common offset are checked first using binary search and
memcmp,  Then offsets at 4  and 8.
All other offsets are checked in a manner similar to blkid.

There is also an alternative method to use just the file
extension.
 
I would have ported it to toybox as `file` a long time ago,
but I have a lot of really obscure formats included and
wasn't really sure which ones to omit and/or make
configurable.
 
-R,
 Brad Conroy

 1455515075.0


More information about the Toybox mailing list