libmagic
- file/file
- src/magic.h.in
- libmagic
- file.1
- 类似项目
- go net/http#DetectContentType
- whatwg mimesniff
- pure go h2non/filetype
- adrian-thurston/ragel
- WASM npcz/magic
- 只能 detect 文件 - 传递 path
- go net/http#DetectContentType
file -b --mime-type README.md # text/plain
file -bsi /dev/nul # application/x-empty; charset=binary
flag | demo |
---|---|
-i,--mime | text/plain; charset=utf-8 |
--mime-type | text/plain |
--mime-encoding | utf-8 |
-z,--uncompress | |
-Z,--uncompress-noreport |
- -P, --parameter
- bytes=1048576 - 最多读取 1MB
- encoding=65536 - 扫描多少 bytes
- elf_notes=256
- elf_phnum=2048
- elf_shnum=32768
- indir=50 - indirect
- name=50
- regex=8192
magic
- magic.4
- magic/Magdir
- file 现有的 magic 定义
- /usr/local/share/misc/magic - 未编译
- /usr/local/share/misc/magic.mgc - 编译后