Skip to content

♻ Incremental backup system for SQLite databases written in TypeScript

Notifications You must be signed in to change notification settings

barthofu/saveqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SaveQLite

Incremental backup system for SQLite databases written in TypeScript!

Description

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.

Credits

This library is a cleaned up and TypeScript adapted version of sqlite3-incremental-backup by nokibsarkar, which was itself built after this StackOverflow discussion.

Getting Started

Requirements

Installing

npm install saveqlite

or

yarn add saveqlite

Usage

  1. Backup a .sqlite file
import { backup } from 'saveqlite'

backup(
    './db.sqlite',
    'snapshot1.txt'
)
  1. Restore a backup
import { restore } from 'saveqlite'

restore(
    './backup.sqlite',
    'snapshot1.txt'
)

Contributing

Pull requests are welcome.

Building for production

To run the production build use the npm build script:

npm run build

License

ISC License

Copyright (c) barthofu