TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 817 forks source link

Being able to connect to a database that is located in a Buffer variable #1760

Open Dev-InSoft opened 9 months ago

Dev-InSoft commented 9 months ago

Summary

In an Azure Functions server, a request receives an SQLite database file as a parameter. It reads it from FORMDATA and assigns it to a variable. It would be nice if you could connect to a database without having to store the buffer on disk.

Proposed implementation

Azure Functions do not allow writing to disk in certain environments, so it is not necessary to connect to the in-memory database

segevfiner commented 9 months ago

I'd assume the way to do this is binding sqlite3_serialize and sqlite3_deserialize. SQLite3 can't directly work against some random buffer, but it can deserialize from it and serialize to a new buffer.