Registry / storage / saveqlite

saveqlite

JSON →
library1.1.2jsnpmunverified

saveqlite is a TypeScript library for incremental backup of SQLite databases. Version 1.1.2 provides functions to create incremental backups and restore them, reducing storage overhead by only saving changes since the last snapshot. It is based on sqlite3-incremental-backup and requires Node.js >=14 and npm >=8. Released as an npm package, it is actively maintained.

npm install saveqlite
INSTALL
IMPORT
SIG · SAVEQLITE
S
saveqlite
storagejavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

backup
import { backup } from 'saveqlite'
const { backup } = require('saveqlite')
saveqlite is ESM-only; CommonJS require may fail if the package is not transpiled.
restore
import { restore } from 'saveqlite'
import restore from 'saveqlite'
restore is a named export, not default.
backup and restore together
import { backup, restore } from 'saveqlite'
import * as saveqlite from 'saveqlite'
Wildcard import works but may import unintended internals.

Demonstrates incremental backup and restore using the two main functions from saveqlite.

import { backup, restore } from 'saveqlite' // Incremental backup of 'db.sqlite' to snapshot file backup( './db.sqlite', 'snapshot1.txt' ) // Restore from snapshot to a new or existing database file restore( './backup.sqlite', 'snapshot1.txt' )
Debug
Known issues
breakingsaveqlite uses synchronous file I/O, blocking the event loop during backup/restore.
fix
Consider wrapping calls in a Worker thread or using asynchronous alternatives for large databases.
affects: >=1.0.0
gotchaThe backup snapshot file is not human-readable; treat it as opaque binary data.
fix
Do not edit or attempt to parse snapshot files manually.
affects: >=1.0.0
gotchaRestoring from a snapshot overwrites the target database file if it exists.
fix
Ensure the target path is either empty or you intend to overwrite.
affects: >=1.0.0
gotchaThe library does not automatically compress snapshots; file sizes may be large for frequently updated databases.
fix
Manually compress snapshot files after creation, e.g., using gzip.
affects: >=1.0.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open './db.sqlite'
The source database file does not exist at the given path.
fix
Verify the file path and ensure the database file exists before calling backup.
TypeError: (intermediate value).isMutex is not a function
Incompatible version of better-sqlite3 or missing peer dependency.
fix
Install better-sqlite3 version ^7.0.0 and ensure it matches the expected API.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
24
Meta
2
Amazon
1
Resources
saveqlite — npm install saveqlite · libregistry