LokiDB icon indicating copy to clipboard operation
LokiDB copied to clipboard

[Request] Cordova-fs-adapter

Open mesqueeb opened this issue 6 years ago • 6 comments

I'm currently using the old LokiJS, which is great, but when the new LokiDB releases, I'd love to switch. 🔄

I see there's a wonderful arsenal of adapters ready for LokiDB. There is only one adapter that I'd like to request extra. 📌

This adaptor is abandoned three years ago but still works on cordova v8 and cordova-ios v5 versions in my tests. It's amazing as it allows cordova apps to save Loki data to the File Storage. Which is persistent (unlike indexedDB which might get deleted by iOS during low memory).

If any one of you JS Gurus could look at the source code (only 100 lines!) and create an official version for LokiDB that'd be super cool! 😎

If any further information is required on Cordova File Storage, they have a great guide on this in their docs.

Happy easter! 🥚 🗿

mesqueeb avatar Apr 08 '19 23:04 mesqueeb

I was able to do that ...please check out https://github.com/LokiJS-Forge/LokiDB/issues/84 I haven't had time to put in a repo yet.

greaterking avatar Apr 20 '19 18:04 greaterking

Hi @greaterking thanks for your comment!! Unfortunately i don’t use ionic. :( I use VueJS with Cordova ;)

mesqueeb avatar Apr 21 '19 00:04 mesqueeb

@mesqueeb hopefully you'll be able to port this over somehow I hope since its all js in the end ..but glad I could help :)

greaterking avatar Apr 21 '19 12:04 greaterking

@mesqueeb Is it true that iOS on low memory is deleting indexedDB persistent memory? I am making an Ionic4 app for iOS and I need to use persistent memory for a huge amount of data. Can you please reply, its critical. Thank you

Marko-Matijevic avatar Jun 26 '19 12:06 Marko-Matijevic

It's true. You need to use Filestorage instead. Don't know how to best do that.

mesqueeb avatar Jun 27 '19 03:06 mesqueeb

As mentioned earlier you need to use the file storage adapter which leverages the official Cordova file plugin to persist the data to the devices file system. Since the adapter part of Loki isn’t tightly coupled you should be able to write your own..I did for use with ionic. Other frameworks you’ll just have to look at existing examples, build and share. If not you’ll have to use another lib like couchdb and others.

greaterking avatar Jun 27 '19 04:06 greaterking