sqlite-wasm icon indicating copy to clipboard operation
sqlite-wasm copied to clipboard

Support for writting into file with nodefs

Open lygstate opened this issue 6 years ago • 2 comments

lygstate avatar Jan 03 '19 17:01 lygstate

The Node.js File System API doesn't meet the SQLite "VFS" API because Node.js provides asynchronous functions but SQLite requires synchronous functions. (Node.js also provides synchronous version of these functions, but they block all other async tasks running in the same thread.)

Although I haven't tried it yet, Asyncify should be helpful to solve that problem: it converts some synchronous function calls (and currently all function pointer calls) into asynchronous ones.

mandel59 avatar Jan 07 '19 15:01 mandel59

Oh, I haven't cared the fact that the SQLite API would be async too if Asyncify is enabled, and it is not so obvious that JavaScript code is able to call async functions in C. The way to do so is not well documented.

mandel59 avatar Jan 07 '19 15:01 mandel59