How to know file type without extension

风流意气都作罢 提交于 2019-12-06 09:23:57

Yeap you can figure out the type without an extension using the magic number. Also, the way the file command figures it out, is actually through a 3 step check:

  1. Check for filesystem properties to identifie empty files, folders, etc...
  2. The said magic number
  3. In text files, check for language in it

Here's a library that'll help you with Magic Numbers: jmimemagic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!