filetype

    Dark Mode
Search:
Group by:

Procs

proc match(buf: openArray[byte]): FileType {...}{.raises: [], tags: [].}
Returns a file type from matched magic number. Returns a empty FileType if buf was not matched any matchers.

Example:

var buf: seq[byte]
doAssert buf.match() == FileType()

from filetype/image import typeGif
doAssert @['G'.byte, 'I'.byte, 'F'.byte, '8'.byte, '7'.byte, 'a'.byte].match() == typeGif
proc matchFile(file: string): FileType {...}{.raises: [IOError, OSError, Exception],
    tags: [ReadDirEffect, ReadIOEffect, WriteIOEffect].}

Returns a file type from matched magic number. file is a file path.

Note: Not available for JS backend.

Exports

newFileType, FileType, Mime, isBmp, typeGif, isBmpFile, typeDwg, isPng, isDwgFile, typeBmp, isJpegFile, typeJpeg2000, isPsd, isIco, isJpeg, typeCr2, isJxrFile, isJpeg2000File, isPngFile, isCr2File, typeTiff, isJpeg2000, typeJpeg, isGifFile, isTiffFile, isWebp, isJxr, typeIco, isCr2, isDwg, typePng, isGif, typeHeif, imageMatcher, isWebpFile, isPsdFile, isIcoFile, typeWebp, isTiff, typeJxr, typePsd, typeLz, isZipFile, typePs, typeElf, typeEpub, isDeb, typeXz, isPsFile, archiveMatcher, typeDcm, typeEot, isSqliteFile, typeDeb, typeCab, typeIso, typeZip, typeMachO, isCrx, typeNes, isBz2, typeAr, typeZ, isPdf, isRpm, isGzFile, typeRtf, isRtf, isRpmFile, isNes, isZip, isLz, typePdf, isAr, typeCrx, is7z, typeTar, typeSwf, typeRpm, isElfFile, isExe, type7z, isArFile, isRtfFile, typeGz, typeSqlite, typeRar, isPdfFile, typeBz2, isLzFile, isDebFile, typeExe, isBz2File, isXz, isSqlite, isNesFile, isXzFile, isPs, isElf, isGz, is7zFile, isCrxFile, isExeFile, isMidi, typeWav, isAmr, isOggFile, isMp3, isOgg, typeMidi, isMp3File, isWav, isAacFile, isAac, isMidiFile, isFlac, typeMp3, typeM4a, typeFlac, audioMatcher, isAmrFile, isFlacFile, typeAmr, isWavFile, typeAac, typeOgg, isWoffFile, typeWoff, isOtf, isOtfFile, isTtf, typeTtf, isTtfFile, isWoff2File, typeWoff2, fontMatcher, isWoff, isWoff2, typeOtf, isAviFile, type3gp, isMp4, typeWmv, isWmv, videoMatcher, isFlvFile, isFlv, typeFlv, isMp4File, typeMp4, isWmvFile, isMpeg, isMpegFile, typeAvi, typeMov, typeM4v, typeMpeg, isAvi, typeWebm, typeMkv