I would like change PouchDB directory in my Electron App. When i update my APP (re-install), all my data are destroyed.
So, i would like change my PouchDB directory for no remove my data when i re-install my App.
My code :
import PouchDB from 'pouchdb';
const Presentation = new PouchDB('~/test/db');
This return an error :
err {type: "OpenError", name: "OpenError", cause: Error: IO error: ~/test/db/LOCK: Aucun fichier ou dossier de ce type, message: "IO error: ~/test/db/LOCK: Aucun fichier ou dossier de ce type", stack: "OpenError: IO error: ~/test/db/LOCK: Aucun fichier…es/abstract-leveldown/abstract-leveldown.js:39:16"}
Anyone know how i can change my directory or just not remove my data when i re-install my Electron App ?
Thank you community !
~ is a Bash feature called "tilde expansion". It's a function of the shell, electron can't process it. Use new PouchDB('./test/db') record instead.
You can use pouchdb-dump-cli package to export database dump and then import it using pouchdb-load package.