Install
openclaw skills install detect-file-type-localLocal, offline AI-powered file type detection — no network, no API keys
openclaw skills install detect-file-type-localLocal-only, offline file type detection. Uses an embedded ML model (Google Magika) to identify 214 file types by content — no network calls, no API keys, no data leaves the machine. All inference runs on-device via ONNX Runtime.
.pdf.exe, .xlsx.lnk)pip install detect-file-type-local
From source:
pip install -e /path/to/detect-file-type-skill
detect_file_type path/to/file
detect_file_type file1.pdf file2.png file3.zip
detect_file_type --recursive ./uploads/
cat mystery_file | detect_file_type -
# Optional best-effort fast path (head only)
cat mystery_file | detect_file_type --stdin-mode head --stdin-max-bytes 1048576 -
detect_file_type --json file.pdf # JSON (default)
detect_file_type --human file.pdf # Human-readable
detect_file_type --mime file.pdf # Bare MIME type
python -m detect_file_type path/to/file
Single file returns an object; multiple files return an array.
{
"path": "document.pdf",
"label": "pdf",
"mime_type": "application/pdf",
"score": 0.99,
"group": "document",
"description": "PDF document",
"is_text": false
}
| Field | Type | Description |
|---|---|---|
path | string | Input path (or - for stdin) |
label | string | Detected file type label (e.g., pdf, png, python) |
mime_type | string | MIME type (e.g., application/pdf) |
score | float | Confidence score (0.0–1.0) |
group | string | Category (e.g., document, image, code) |
description | string | Human-readable description |
is_text | bool | Whether the file is text-based |
| Code | Meaning |
|---|---|
| 0 | All files detected successfully |
| 1 | Fatal error (no results produced) |
| 2 | Partial failure (some files failed, some succeeded) |
Errors are printed to stderr. Common cases:
error: path/to/file: No such file or directoryerror: path/to/file: Permission deniederror: path/to/dir: Not a regular fileWhen processing multiple files, detection continues for remaining files even if some fail.
spool) writes stdin to a temporary file and uses Magika path detection.--stdin-mode head is best effort and may miss trailing-byte signatures.empty