Backing up a SQLite database file on a regular basis can quickly become really heavy! Indeed, the total weight of your backup will be (database_size * num_backups)
.
With an incremental backup system, only the difference since the last snapshot is saved!
So we end up with a lightweight save, including multiple snapshots to rollback to any state of the database.
This library is a cleaned up and TypeScript adapted version of sqlite3-incremental-backup by nokibsarkar, which was itself built after this StackOverflow discussion.
npm install saveqlite
or
yarn add saveqlite
- Backup a .sqlite file
import { backup } from 'saveqlite'
backup(
'./db.sqlite',
'snapshot1.txt'
)
- Restore a backup
import { restore } from 'saveqlite'
restore(
'./backup.sqlite',
'snapshot1.txt'
)
Pull requests are welcome.
To run the production build use the npm build script:
npm run build
ISC License
Copyright (c) barthofu