A tiny Deno module to check whether if a file is an archive or not.
import { isArchive } from 'https://deno.land/x/[email protected]/mod.ts'
console.log(await isArchive('path/to/archive.tar'))
Important: you must run your program with --allow-read as this module needs to read the file.
You can install this module globally with:
deno install --allow-read -n is-archive mod.ts
Then use it from your CLI:
$ is-archive path/to/archive.tar
$ ✅ - path/to/archive.tar is an archive!
This module compares the first bytes of the input file to known archive formats magic bytes.
- ZIP
- LZIP
- TAR
- GZIP
- XZ
- LZ4
- BZIP2
- RNC
- RAR
- XAR
- OAR
- 7ZIP
- CAB
- QUANTUM
- DEB
- ZLIB
- LZFSE
- ZSTANDARD
- QUICKZIP
If you feel an archive format is missing, don't hesitate to contribute!
MIT License