[Feature] Support on-the-fly extraction for single-file archives on download (?extract=true)

Open
#5,772 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
docker, nginx, python
Domain
api, backend

Research direction

The request centers on the ROM content download endpoint (GET /api/roms/{id}/content/{file_name}) and on how rahasher.py invokes the bundled 7zz binary. Start by reading how archives are listed and where the cache directory under ROMM_TMP_PATH is used, then check how X-Accel-Redirect is currently set for downloads. Done means a single-file archive with ?extract=true streams uncompressed with a correct Content-Length, while multi-file archives return 400 or 406; design choices about caching and cleanup are still open.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.

Many users store their ROM libraries compressed (.zip / .7z) on their server to save storage space. However, when third-party console and handheld clients (such as Nintendo 3DS, PS Vita, Wii, or Xbox 360 homebrew downloaders) fetch ROMs over HTTP, extracting archives on-device is severely bottlenecked by slow CPUs, low RAM, and slow SD/storage I/O. On devices like the 3DS, downloading a .zip and extracting it locally forces double SD card I/O and requires 2x free storage space, making the process several times slower than streaming an uncompressed file over Wi-Fi.

While existing issues like #2619 propose permanently decompressing files inside the server's library storage on disk, there is currently no way to keep the library compressed on the server while delivering single-file ROMs uncompressed on demand during download

Describe the solution you'd like

Add an optional query parameter to the download endpoint (e.g., GET /api/roms/{id}/content/{file_name}?extract=true) for single-file archives:

  1. Inspect the archive to verify it contains a single ROM file (excluding multi-file archives or returning 400/406 if multiple files are present so behavior stays predictable).

  2. Reuse RomM's existing 7zz extraction tooling (already bundled and used by rahasher.py) to extract the file into a temporary cache directory (similar to $ROMM_TMP_PATH/cache/converts).

  3. Serve the extracted file directly via nginx X-Accel-Redirect with the uncompressed filename and accurate Content-Length header so clients can stream it straight to storage in a single pass.

Describe alternatives you've considered

• Storing the entire library uncompressed on the server (#2619): Significantly increases NAS/server storage usage for DS, 3DS, and disc-based systems.

• Using rom-converto (?format=): Only handles specific disc/system conversions and does not support extracting standard cartridge/handheld archives (.nds, .cia, .3ds, .gba, etc.) or arbitrary single-file archives.

• Running a custom reverse proxy sidecar: Works locally, but native API support benefits all third-party console/handheld RomM clients (such as 3DS, Vita, and Aurora clients).

Dominant language
Python
Stars
13.3k
Forks
747
Avg merge
20h 58m
Merged PRs (30d)
207

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rommapp/romm

All issues in rommapp/romm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.