Level / level

Universal abstract-level database for Node.js and browsers.
MIT License
1.55k stars 106 forks source link

[Question] how can "level-js" make data persistence? #208

Closed Moon1102 closed 2 years ago

Moon1102 commented 2 years ago

When I develop a vscode plugin(used vscode WebView Api), I use level to save some data. Then I found the data will be saved to IndexedDB and it works great. BUT When I reopen plugin,the data all missed,even because of the isolation mechanism of vscode WebView, the data stored in page A cannot be obtained in page B.... Unlike in the node project,all data will be saved in local files.

How can I make data persistence? Can level-js save data to local files?

I would appreciated if someone can give me any advice.

vweevers commented 2 years ago

I'm not familiar with vscode internals but it sounds like you need a Node.js-like context (if that's available in vscode). Then level would use LevelDB instead of IndexedDB. Alternatively, check if you can make the session of the webview persistent.

Moon1102 commented 2 years ago

okay,perhaps webview send the data to the plugin first and then being processed and stored by the plugin is a possible way. Thanks a lot. I'll try it later.