Skip to main content

Recover Amiga XPK files, including files written through XFH

Project description

🗜️ xfh

xfh is a pure-Python library and command-line tool for recovering files compressed with the Amiga XPK system, including files written transparently through DiskExpander.

It requires Python 3.10 or newer and has no runtime dependencies.

Install

python -m pip install xfh

Help

xfh --help
xfh info --help
xfh verify --help
xfh unpack --help

You can also run the command as python -m xfh.

Use

Inspect a packed file:

xfh info packed-file

Verify that a file decompresses successfully without writing its contents:

xfh verify packed-file

Recover a file:

xfh unpack packed-file recovered-file

Existing output files are not overwritten unless --force is supplied. Output is limited to 256 MiB by default; use --max-output-size to choose a different byte limit.

For a damaged stream, salvage mode writes the prefix recovered before the first failing chunk. It exits with status 4 when recovery is incomplete:

xfh unpack damaged-file recovered-prefix --salvage --report recovery.json

Keep the original packed file unchanged and validate salvaged output with tools appropriate for its file type.

Python

from pathlib import Path

import xfh

packed = Path("packed-file").read_bytes()
info = xfh.inspect(packed)
plain = xfh.decompress(packed)

print(info.codec, len(plain))
Path("recovered-file").write_bytes(plain)

xfh.decompress_file() provides atomic, non-overwriting file output. xfh.Limits controls maximum output size and chunk count.

Supported codecs

xfh supports these XPK codec identifiers:

ACCA, ARTM, BLZW, BZP2, CBR0, CBR1, CRM2, CRMS, CYB2, DLTA, DUKE, ELZX, FAST, FBR2, FRHT, FRLE, GZIP, HFMN, HUFF, ILZR, IMPL, LHLB, LZBS, LZCB, LZW2, LZW3, LZW4, LZW5, MASH, NONE, NUKE, PPMQ, PWPK, RAKE, RDCN, RLEN, SASC, SDHC, SHR3, SHRI, SHSC, SLZ3, SLZX, SMPL, SQSH, TDCS, and ZENO.

CBR1 is an alias for CBR0; FRHT is an alias for RAKE. Password-protected streams are detected but are not currently decoded.

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

xfh-0.2.0.tar.gz (81.5 kB view details)

Uploaded Source

Built Distribution

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

xfh-0.2.0-py3-none-any.whl (58.5 kB view details)

Uploaded Python 3

File details

Details for the file xfh-0.2.0.tar.gz.

File metadata

  • Download URL: xfh-0.2.0.tar.gz
  • Upload date:
  • Size: 81.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for xfh-0.2.0.tar.gz
Algorithm Hash digest
SHA256 13f44b92e9f45f3dd272ea36f507e6260e174c241e8ab7eccded2e26036d9539
MD5 7e5dce7d6e862ddd4d166ec19c5d943a
BLAKE2b-256 9a4860b9e5892481e2c938bb2faed372b2ed5de857d6f05345d8e3a8bf247511

See more details on using hashes here.

File details

Details for the file xfh-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: xfh-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 58.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for xfh-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0806291b5d2e5987e8b1217531babd4afc58e1cd4cddab638243b7567e6d795
MD5 b6da54606f28dbb7164ad8f6accae5ce
BLAKE2b-256 30c21047ee1f7b9dc202cab267095364bee73d62e3286fcb38d443c4fe776218

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