在Electron中更改PouchDB目录

时间:2017-09-14 07:12:08

标签: node.js electron pouchdb

我想在我的Electron App中更改PouchDB目录。当我更新我的APP(重新安装)时,我的所有数据都被销毁了。

所以,当我重新安装我的应用程序时,我想更改我的PouchDB目录,而不删除我的数据。

我的代码:

import PouchDB from 'pouchdb';
const Presentation = new PouchDB('~/test/db');

这会返回错误:

  

错误{类型:" OpenError",名称:" OpenError",原因:错误:IO错误:   〜/ test / db / LOCK:Aucun fichier ou dossier de ce type,message:" IO   错误:〜/ test / db / LOCK:Aucun fichier ou dossier de ce type",stack:   " OpenError:IO错误:〜/ test / db / LOCK:Aucun   fichier ... ES /抽象leveldown /抽象leveldown.js:39:16"}

当我重新安装我的Electron App时,任何人都知道如何更改我的目录或者不删除我的数据?

谢谢社区!

1 个答案:

答案 0 :(得分:0)

〜是一个名为"波浪扩展"的Bash功能。它是壳的功能,电子不能处理它。请改用新的PouchDB(' ./ test / db')记录。

您可以使用pouchdb-dump-cli包导出数据库转储,然后使用pouchdb-load包导入它。