generated fromjiro4989/repo-template-nim
- Notifications
You must be signed in to change notification settings - Fork1
Small and dependency free Nim package to infer file and MIME type checking the magic numbers signature.
License
NotificationsYou must be signed in to change notification settings
jiro4989/filetype
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Small and dependency free Nim package to infer file and MIME type checking the magic numbers signature.filetype is heavily inspired byh2non/filetype.
Table of contents
import filetypelet content=readFile("tests/testdata/sample.png")doAssertmatch(content).extension=="png"doAssertmatchFile("tests/testdata/sample.png").mime.value=="image/png"doAssertisPngFile("tests/testdata/sample.png")ifisZipFile("tests/testdata/sample.zip"):echo"file is zip"
typeFileType*=object mime*:Mime extension*:string## File extension. (ex: `zip`)Mime*=object## MIME type. typ*:string## Ex: `application` of `application/gzip`. subType*:string## Ex: `gzip` of `application/gzip`. value*:string## Ex: `application/gzip` of `application/gzip`.
Seefiletype module.
$ 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
About
Small and dependency free Nim package to infer file and MIME type checking the magic numbers signature.
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published