Test files › Archives › valid.tar
Sample TAR file (valid)
A USTAR tar archive with three files, including one in a subdirectory.
↓ Download valid.tar| Filename | valid.tar |
| Format | TAR |
| Size | 4.0 KB (4,096 bytes) |
| MIME type | application/x-tar |
| SHA-256 | 10423077ca0e6bd4595013c517de17a831309c3c0fa9c79bb3c2f01d46e2ee7c |
What this file catchesTar handling as distinct from zip: no central directory, 512-byte headers, octal size fields. Catches code that assumes "archive" means zip.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Extract with the 'data' filter (Python 3.12+, and backported to security releases of 3.8 to 3.11). It refuses absolute paths, '..', links that point outside the folder and device files. Python 3.14 makes it the default, but passing it keeps older versions safe.
import tarfile
with tarfile.open("valid.tar") as tar: # detects gzip, bzip2 and xz by itself
try:
tar.extractall("out", filter="data")
print("extracted:", ", ".join(m.name for m in tar.getmembers()))
except tarfile.FilterError as e:
print("blocked:", e)Run against this file, it prints: extracted: readme.txt, data/numbers.csv, data/notes.txt
Related guides and tools
Sample 7z, TAR and GZIP filesUpload validation checklistFile signaturesCheck a file's real typeVerify its SHA-256
Download & verify
curl -fsSL -o "valid.tar" "https://files.hexaqa.com/archive/valid.tar"
curl -fsSL "https://files.hexaqa.com/archive/valid.tar" | sha256sum
# expect: 10423077ca0e6bd4595013c517de17a831309c3c0fa9c79bb3c2f01d46e2ee7c