Title: sqlite: add serialize() and deserialize() to DatabaseSync · Issue #62575 · nodejs/node · GitHub
Open Graph Title: sqlite: add serialize() and deserialize() to DatabaseSync · Issue #62575 · nodejs/node
X Title: sqlite: add serialize() and deserialize() to DatabaseSync · Issue #62575 · nodejs/node
Description: What is the problem this feature will solve? There is currently no way to extract a database's contents as a binary buffer or load a database from one. Users may use this for snapshot, clone, transfer, etc. Popular libraries like better-...
Open Graph Description: What is the problem this feature will solve? There is currently no way to extract a database's contents as a binary buffer or load a database from one. Users may use this for snapshot, clone, trans...
X Description: What is the problem this feature will solve? There is currently no way to extract a database's contents as a binary buffer or load a database from one. Users may use this for snapshot, clone, t...
Opengraph URL: https://github.com/nodejs/node/issues/62575
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlite: add serialize() and deserialize() to DatabaseSync","articleBody":"### What is the problem this feature will solve?\n\nThere is currently no way to extract a database's contents as a binary buffer or load a database from one. Users may use this for snapshot, clone, transfer, etc. Popular libraries like `better-sqlite3` expose `db.serialize()` and `new Database(buffer)` for this purpose.\n\n### What is the feature you are proposing to solve the problem?\n\nAdd serialize() and deserialize() methods to DatabaseSync:\n\n```javascript\nconst { DatabaseSync } = require('node:sqlite');\n\n// serialize: returns the database as a Uint8Array\nconst db = new DatabaseSync(':memory:');\ndb.exec(\"CREATE TABLE t(x TEXT)\");\ndb.exec(\"INSERT INTO t VALUES ('hello')\");\nconst buffer = db.serialize(); // Uint8Array\n\n// deserialize: loads a buffer into the connection, replacing the current database\nconst db2 = new DatabaseSync(':memory:');\ndb2.deserialize(buffer);\ndb2.prepare('SELECT * FROM t').get(); // { x: 'hello' }\n```\n\n### What alternatives have you considered?\n\n1. VACUUM INTO + fs.readFileSync: Requires disk I/O, a temp file path, and manual cleanup\n2. backup() API","author":{"url":"https://github.com/thisalihassan","@type":"Person","name":"thisalihassan"},"datePublished":"2026-04-03T11:50:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/62575/node/issues/62575"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7a346491-9171-a135-eb28-b0a9f1f7f0c2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D26:B2172:452ED9:5FF85C:6A4C81A3 |
| html-safe-nonce | c9655039453dfcc699e77e4c5b8fe7f38e5604c6369a56c4850f448e17f657eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDI2OkIyMTcyOjQ1MkVEOTo1RkY4NUM6NkE0QzgxQTMiLCJ2aXNpdG9yX2lkIjoiNTQ4NzMxMTQ5MTE1NjQ0MzU1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | feef65eec11ac1fa64b26ce1ad859e92d1f803119cbb72bfe0cef66412833afd |
| hovercard-subject-tag | issue:4200219170 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62575/issue_layout |
| twitter:image | https://opengraph.githubassets.com/da3e7aac50ab8b156d80d7a773439c2f18b6d3d3a049abde56c76aef8cdd4361/nodejs/node/issues/62575 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/da3e7aac50ab8b156d80d7a773439c2f18b6d3d3a049abde56c76aef8cdd4361/nodejs/node/issues/62575 |
| og:image:alt | What is the problem this feature will solve? There is currently no way to extract a database's contents as a binary buffer or load a database from one. Users may use this for snapshot, clone, trans... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thisalihassan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd470457e909b9d062f8002cf438ba870e6acff6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width