How to format detector vs the `file` command and `7z l`
- Step 1Decide whether the file is sensitive or local-only — If the file is confidential or sits on a machine where you can't install tools, the browser detector wins — it reads locally and uploads nothing. If it's a routine file on your own dev box,
fileis just as good. - Step 2For one-off identification, use the detector — Open the auto-format-detector, drop the file, and read the Format and Magic-bytes metrics. No flags, no man page.
- Step 3For scripting many files, use the CLI — If you're iterating over a directory in a shell pipeline,
file *or a loop calling7z lis the right tool — the browser detector handles one file at a time and isn't scriptable. - Step 4Cross-check a surprising result — If
fileand the detector disagree, compare the magic-byte hex both report. They read the same bytes, so a mismatch usually means one tool inspected a different offset (for example,filemay recognise a wrapped inner format the detector reports by its outer layer). - Step 5Act on the format — Once identified, open or convert the file. The detector links you straight to the matching sibling — for example a 7z result points to the multi-format extractor, which
7zwould handle on the CLI. - Step 6Copy the report for a ticket — Copy the detector's JSON (or download
<filename>-format.json) to attach to a bug report — it includes the filename, format, magic hex, and recommendations in one block, like a curatedfileoutput.
Detector vs common CLI identifiers
All four read the file's bytes rather than trusting the extension. The browser detector trades scriptability and format breadth for zero-install, zero-upload convenience.
| Capability | Format Detector (browser) | `file` (Unix) | `7z l` / `unzip -l` |
|---|---|---|---|
| Install required | None — runs in any browser | Usually preinstalled on Linux/macOS | Must install 7-Zip / unzip |
| Uploads the file | Never | N/A (local) | N/A (local) |
| Ignores extension | Yes (magic bytes) | Yes (magic bytes) | Tries to open as that format |
| Scriptable / batch | No (one file per run) | Yes | Yes |
| Formats recognised | ZIP, GZIP, TAR, BZIP2, XZ, 7z, RAR | Hundreds | Mainly the one format the tool handles |
| Shows magic hex | Yes (first 8 bytes) | With --hex | No |
| Lists entries inside | No | No | Yes |
| Suggests next tool | Yes | No | No |
What each format reports in the detector
The detector's format values, with the equivalent any magic-byte identifier would report. A .tar.gz reports as gz because the outer bytes are GZIP.
| File | Detector result | Magic bytes | Notes |
|---|---|---|---|
| plain .zip | zip | 50 4B ... | Matches file's 'Zip archive data' |
| plain .gz | gz | 1F 8B ... | Matches file's 'gzip compressed data' |
| .tar.gz | gz | 1F 8B ... | Detector reports the outer GZIP layer |
| plain .tar | tar | ustar @257 | Needs >= 262 bytes to detect |
| .7z | 7z | 37 7A BC AF 27 1C | file and 7z l agree |
| .rar | rar | 52 61 72 21 | Read-only here; libarchive can read it |
| .iso | unknown | varies | Volume descriptor is too deep to sniff |
When to use which
Pick by context, not by which is 'better' — they target different situations.
| Situation | Best choice | Why |
|---|---|---|
| Confidential file, no upload allowed | Format Detector | Reads locally, uploads nothing |
| Locked-down laptop, no CLI | Format Detector | Zero install, runs in browser |
| Scripting over 1000 files | file in a loop | Batchable and fast |
| Need to list archive contents | 7z l / archive-previewer | Detector only IDs the container |
| Exotic format (LZ4, Zstd, CAB) | file | Detector returns unknown for these |
| One unknown file, want next step | Format Detector | Names the format and the tool to use |
Cookbook
Side-by-side scenarios contrasting the detector with the equivalent CLI command, so you can see when each is the right call.
Mislabelled archive: detector vs file
A teammate sent data.zip that won't open. On a machine with the CLI you'd run file data.zip; on a locked-down laptop you drop it on the detector. Both read the same bytes and agree it's a 7z.
CLI:
$ file data.zip
data.zip: 7-zip archive data, version 0.4
Detector:
{
"format": "7z",
"magicBytes": "37 7A BC AF 27 1C 00 04",
"recommendedTools": ["multi-format-extractor", "archive-previewer"]
}tar.gz: detector says gz, file says the same outer layer
Both tools read offset 0, see the GZIP signature, and report GZIP. Neither claims it is a 'tar.gz' from the header alone — you only know about the inner TAR after decompressing.
CLI:
$ file release.tar.gz
release.tar.gz: gzip compressed data, ...
Detector:
{
"format": "gz",
"magicBytes": "1F 8B 08 00 00 00 00 00",
"recommendedTools": ["gzip-to-zip", "tar-gz-to-zip"]
}Listing contents: a job the detector does NOT do
If you actually need the file list, the detector can't help — it only names the container. Use 7z l on the CLI or the archive-previewer in the browser.
CLI (lists entries):
$ 7z l app.7z
Date Time Size Name
2026-06-01 10:00 1024 src/index.ts
2026-06-01 10:00 512 README.md
Detector (container only):
{ "format": "7z", "recommendedTools": ["multi-format-extractor", "archive-previewer"] }
→ use archive-previewer to list entries in the browser.Exotic format: where the CLI wins
A Zstandard file (logs.zst). file knows it; the detector doesn't have a Zstd signature, so it returns unknown. For formats outside the supported set, reach for file.
CLI:
$ file logs.zst
logs.zst: Zstandard compressed data
Detector:
{
"format": "unknown",
"magicBytes": "28 B5 2F FD 04 58 ...",
"recommendedTools": []
}No-upload requirement: where the browser wins
A vendor sent an encrypted customer-data archive you may not upload to any third party. You also lack admin rights to install 7-Zip. The detector reads it locally in the browser and never sends a byte.
Constraint: file cannot leave the laptop; no install permitted.
Detector (runs entirely client-side):
{
"filename": "customer-export.bin",
"format": "zip",
"magicBytes": "50 4B 03 04 14 00 08 00"
}
→ encrypted-archive-detector can then check if it's password-protected.Edge cases and what actually happens
Detector and file disagree
ExpectedBoth read magic bytes, so they agree for shared formats. A difference usually means file recognised a wrapped inner format or an offset the detector doesn't inspect — compare the magic hex both report to reconcile them.
Need to script over many files
Use CLIThe browser detector handles one file per run and isn't scriptable. For directory-wide identification, file * or a shell loop is the correct tool. The detector targets the single-file, no-install case.
Format outside the supported set
unknownLZ4, Zstandard, CAB, and other formats have no signature in the detector's table, so it returns unknown. file knows far more formats; use it when you suspect something exotic.
File is 2 GB, over the Developer cap is exceeded
Rejected (tier limit)Even the top tier caps files at 2 GB. A multi-gigabyte image past that is rejected before detection. The CLI has no such cap and is the right tool for very large files.
tar.gz reported as gz
By designLike file, the detector reports the outermost format from offset 0, which is GZIP. It does not return tar.gz from the header. This matches CLI behaviour — you learn the inner TAR only after decompressing.
Listing entries inside the archive
Not supportedThe detector identifies the container only; it never lists files. That's a job for 7z l / unzip -l on the CLI or the archive-previewer in the browser.
Old GNU tar without ustar magic
unknownThe detector needs ustar at offset 257; pre-POSIX TARs lack it and report unknown, whereas file has extra heuristics and may still recognise them. For odd legacy TARs, the CLI is more forgiving.
Self-extracting EXE archive
unknownThe file starts with an executable stub, so its first bytes aren't an archive signature and the detector returns unknown. file reports it as a PE/EXE; the archive payload is appended after the stub.
Frequently asked questions
Is the detector as accurate as the `file` command?
For the formats both support, yes — they use the same magic-byte technique and read the same bytes, so they agree. The difference is breadth: file recognises far more formats.
Why use a browser tool when I have `file` installed?
When the file is confidential and can't be uploaded, when you're on a locked-down machine without the CLI, or when you want the format plus a recommended next tool in one click. On your own dev box, file is fine.
Does the detector ever beat the CLI on speed?
Not for huge files — the CLI reads only the header and is instant. The detector also only needs the header for the answer, but it loads the file into the browser first, so for multi-gigabyte files the CLI is faster.
Can the detector list the files inside, like `7z l`?
No. It identifies the container format only. To list entries, use 7z l / unzip -l on the CLI or the archive-previewer in the browser.
Will it recognise everything `file` does?
No. It recognises ZIP, GZIP, TAR, BZIP2, XZ, 7z, and RAR. For formats outside that set (LZ4, Zstd, CAB, ISO, and so on) it returns unknown while file would name them.
Why does my .tar.gz report as gz in both tools?
The outermost bytes are GZIP, so both report GZIP. The inner TAR is only visible after decompression. Use the tar-gz-to-zip converter to unwrap both layers.
Is the detector scriptable?
No — it runs one file at a time in the browser. For automation across many files, use file in a shell loop or build it into your pipeline.
Does the detector send my file anywhere, unlike an online sandbox?
No. It reads the file locally via the browser File API and uploads nothing, which is its key advantage over web services that require an upload.
Can I see the magic bytes like `xxd` would show?
Yes — the result includes the first 8 bytes as uppercase hex, comparable to xxd | head or file --hex, so you can verify the signature yourself.
If the detector says unknown, is the file broken?
Not necessarily. It may be a format the detector doesn't know, an ISO, a self-extracting EXE, or genuinely corrupt. Run file for a second opinion, or check readability with the archive-integrity-tester.
What's the equivalent CLI for converting after detection?
Once identified, the detector links to converters like gzip-to-zip; the CLI equivalent would be gzip -d then zip. Both reach the same result.
Which is better for an audit trail?
The detector's downloadable JSON (<filename>-format.json) packages the format, magic hex, and recommendations in one file, which is tidier to attach to a ticket than copying terminal output.
Privacy first
Every JAD Archive tool runs entirely in your browser using fflate, @zip.js/zip.js, and the libarchive WASM bridge. Your archives never leave your device — verified by zero outbound network requests during processing.