filetype |
---|
Small and dependency free Nim package to infer file and MIME type checking the magic numbers signature. |
filetype is heavily inspired by h2non/filetype. |
Table of contents |
Usage |
import filetype
doAssert matchFile("tests/testdata/sample.png").mime.value == "image/png"
doAssert isPngFile("tests/testdata/sample.png")
if isZipFile("tests/testdata/sample.zip"):
echo "file is zip"
$ nimble install -Y filetype
Type | Format |
---|---|
Image | jpeg, jp2, png, gif, webp, cr2, tiff, bmp, jxr, psd, ico, dwg |
Archive | gz, zip, bz2, 7z, pdf, exe, rtf, nes, crx, ps, xz, sqlite, deb, ar, lz, rpm, elf |
Audio | midi, ogg, flac, wav, amr, mp3, aac |
Font | woff, woff2, ttf, otf |
Video | wmv, flv, avi, mpeg, mp4 |
MIT