Skip to content

Implement backup in node:sqlite and add ArrayBuffer support for database paths and backup targets #29439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nestarz opened this issue May 24, 2025 · 0 comments
Labels
node:sqlite Issues related to the `node:sqlite` module

Comments

@nestarz
Copy link
Contributor

nestarz commented May 24, 2025

The node:sqlite module in Deno currently lacks the backup function, which is part of the node:sqlite API in Node.js (as seen in the Node.js documentation at https://nodejs.org/api/sqlite.html#sqlitebackupsourcedb-path-options). This absence prevents users from performing direct database backups programmatically using the node:sqlite compatibility layer.

Furthermore, when working with in-memory database operations or managing database content directly in memory (e.g., for custom serialization, encryption, or temporary processing), the DatabaseSync constructor's path argument only support string.

Describe the solution you'd like

I would like to request two key enhancements for the node:sqlite module in Deno:

  1. Implement backup function: Please implement the backup function as it exists in Node.js, accessible via import { backup } from "node:sqlite";. This function is essential for creating database backups.

  2. Add ArrayBuffer support for database paths and backup targets:

    • For the DatabaseSync constructor: Allow the path argument to accept an ArrayBuffer. This would enable direct instantiation of an in-memory database from an ArrayBuffer.
    • For the newly implemented backup function: Allow the path argument (the backup target) to accept an ArrayBuffer. This would enable writing the database backup directly into a provided ArrayBuffer.

Describe alternatives you've considered

Currently, there is no direct alternative for sqlite.backup within Deno's node:sqlite module, requiring users to resort to wasm sqlite implementations or manual file operations for backups.

@littledivy littledivy added the node:sqlite Issues related to the `node:sqlite` module label May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node:sqlite Issues related to the `node:sqlite` module
Projects
None yet
Development

No branches or pull requests

2 participants