app-backup-to-zip-mediastore
Installation
SKILL.md
Backing an app up to a zip in the user's Downloads
Android only. Three moving parts, and the order between them is the whole feature:
- Checkpoint the database's write-ahead log (WAL), then copy the database file.
- Assemble the zip into the app's own cache directory.
- Stream that temp file into a row you insert in the system media store, then prune.
Checkpoint, then copy
A database in write-ahead-log mode keeps recent commits in a side log, not in the main database file. Copying the file alone gives you a database as of the last checkpoint — the copy silently omits everything committed since. Ask the database to fold the log back in first: