Skip to main content

Metadata extraction for any file type: detect MIME from magic bytes, read EXIF/GPS, image/audio/video tags, PDF info, archive contents, hashes, and entropy.

Project description

metabeam (Python)

Point it at any file and read everything inside.

metabeam is a metadata extraction engine for any file type. It detects formats by their magic bytes (never the file extension), runs every applicable parser, and returns a structured report as a plain Python dict: hashes and entropy, image geometry, EXIF and GPS, audio tags, video timing, document properties, archive contents, and binary headers.

The package is a compiled Rust extension (built with maturin and PyO3), so parsing is fast and the result matches the CLI and Node packages exactly.

Install

pip install metabeam

Supports CPython 3.8+ on Linux, macOS, and Windows.

Usage

import metabeam

# Parse a file from disk. Raises OSError if it cannot be read.
report = metabeam.parse("photo.jpg")

print(report["file"]["mime_detected"])    # "image/jpeg"
print(report["file"]["sha256"])           # full hex digest
print(report["jpeg"]["quality_estimate"]) # estimated JPEG quality
print(report["exif"]["gps_decimal"])      # {"latitude": ..., "longitude": ...}

Parse bytes that never touch disk (an upload, a download, a database blob):

with open("photo.jpg", "rb") as f:
    report = metabeam.parse_bytes(f.read())

The result is a plain dict, so it serializes directly:

import json
print(json.dumps(report, indent=2))

Validate that an upload is really the type it claims

Because detection is by content, not extension, metabeam is a reliable way to reject spoofed uploads:

import metabeam

def is_real_png(data: bytes) -> bool:
    report = metabeam.parse_bytes(data)
    return report["file"]["mime_detected"] == "image/png"

API

  • metabeam.parse(path: str) -> dict - parse a file on disk.
  • metabeam.parse_bytes(data: bytes) -> dict - parse an in-memory buffer.

Every result contains a file namespace (size, detected MIME, SHA-256, CRC-32, entropy). Format-specific namespaces (jpeg, png, exif, id3, mp4, pdf, zip, elf, and more) are added when they apply, so a single file can produce several at once.

Supported formats

JPEG, PNG, GIF, BMP, WebP/WAV/AVI (RIFF), TIFF/HEIC EXIF, MP3 (ID3), MP4/MOV/M4A/HEIF, ELF binaries, PDF, gzip, and the ZIP family (docx, xlsx, pptx, jar, apk, epub). The universal file namespace runs on everything.

Links

License

Licensed under either of MIT or Apache-2.0 at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metabeam-0.1.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

metabeam-0.1.0-cp312-cp312-win_amd64.whl (309.3 kB view details)

Uploaded CPython 3.12Windows x86-64

metabeam-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (422.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

metabeam-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (424.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

metabeam-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (476.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

metabeam-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (474.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file metabeam-0.1.0.tar.gz.

File metadata

  • Download URL: metabeam-0.1.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for metabeam-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b003b75189f33782f53d246754c44109aa6f3f874cee79e867078ca7f46e5a8
MD5 466139b1091a66b4d3399c8044e65d5b
BLAKE2b-256 bcd6557913ef8df118bbe28b3aa2825afd2e3e3d559d06caabc681e2b7a8872c

See more details on using hashes here.

File details

Details for the file metabeam-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: metabeam-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 309.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for metabeam-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a723f800776f35701d06875cbfcf3f19e966b811ab8502efd1b85eb768b471a
MD5 338f00442cb80e4ab9f976e259d73f96
BLAKE2b-256 add63198453bd699553e274d12acf252d4869755940d8e0ef8094abbe27be7c7

See more details on using hashes here.

File details

Details for the file metabeam-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for metabeam-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 355fbcf81d68078bcfed9fd80f3080002353202e4a0e47833d665db46e612b30
MD5 56ee2ad330240581813c6255adccb0f7
BLAKE2b-256 be9622082a40e1e1c9d4528574b49222dc588c3d0e55457026aa5dd04f9ca939

See more details on using hashes here.

File details

Details for the file metabeam-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for metabeam-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 941e7ea86f991e5b2587e8f5ba7a647530f95d42b5c7893e0f163441330db3c7
MD5 32b1fe2dde306bb2f30520fa97e0f7d1
BLAKE2b-256 8b5424f43fa12bd5bee4807805edb8c808a35281a342a8cc4c8a154773b5c3b6

See more details on using hashes here.

File details

Details for the file metabeam-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for metabeam-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ab980daf904b7c0ab32bb32b5cbf9f7e54dceebbe02d559407cd1ed0c3c76e4
MD5 a82b4d3a6579fee340b755c8974016f5
BLAKE2b-256 09407f4fc823511848165da42e7f2a280e7852165ad114cda1b11a2381c800a7

See more details on using hashes here.

File details

Details for the file metabeam-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for metabeam-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aa9c31abc1da0e8336f9e59eb1349b68fa13d7db17ee0e7ae41b3b80851bec97
MD5 7c0fff2b0482a324e9c95e3b26c6d00d
BLAKE2b-256 f015d387a39be9fb4178d19d521a561d9310d54bd13847f808bb947cdad0405b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page