Comments (10)
@Belphemur Thanks a lot it worked 🎉 .
from node-json-db.
Hello @akashnimare
The problem surely lies here: https://github.com/zulip/zulip-electron/blob/fc5b7324d2dc48849e32dc3404116fde1ecfbcc0/app/main/index.js#L16
By default, JsonDB (well OS in general) will open a file relatively to the working directory. When you're developing it's not a problem at all. However, if the user launching the app doesn't have "write access" to the working directory (usually where the app is installed) the OS is not going to let your write hence the error you're seeing.
Also, I have stricly no idea how the library act in a "browser". You should give it a full path with __dirname
since it has not been made to work natively in browser.
from node-json-db.
@Belphemur so is there any way I can make it work. node-json-db
is awesome but if I am not able to use in electron then surely I'll have to use some other db 😞 .
from node-json-db.
I'd say, give a full path.
Using https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname
And https://discuss.atom.io/t/open-external-file-with-electron/18569/7
You should be able to use the userData path for your database.
from node-json-db.
I can't make it work. I used this but no luck-
const data = db.getData(app.getPath('userData') + '/domain.json');
or
const data = db.getData(app.getAppPath() + '/domain.json');
from node-json-db.
Not when calling the getData. When initializing the database.
const db = new JsonDB(app.getPath('userData') + '/domain', true, true);
Same at each place you are creating a JsonDB object.
from node-json-db.
@Belphemur hey, I'm getting this error again -
This happens when the db file is empty. Is there any way to handle this?
from node-json-db.
@Belphemur I don't know why but sometimes the db file gets corrupted which results in #21 (comment). Do you know the possible reason behind this?
from node-json-db.
from node-json-db.
I have only one instance of the db but I do reload the db file sometimes. Here is db file -
https://github.com/zulip/zulip-electron/blob/master/app/renderer/js/utils/domain-util.js
Let me know if you find anything suspicious which might cause this issue. I have no clues here 😭
(FYI only the domain.json
file gets corrupted not others like setting.json, window-state.json
)
from node-json-db.
Related Issues (20)
- Error on production server. HOT 1
- "Error: EPERM: operation not permitted" when json-file is opened for viewing in other program HOT 1
- Error on array support HOT 1
- cant use email as a key for search HOT 2
- Concurent apps locking issues HOT 2
- Export core config types to have adapters available HOT 2
- Arrays indexing fails with numeric keys HOT 3
- Can't getIndex if it is array of objects
- Return undefined or null if an item was not found HOT 2
- Get an object in array by value HOT 1
- Request to Open Pull Request Permission for Repository HOT 1
- hope to add an export method HOT 1
- BUG: The Map type is not saved to a file HOT 2
- More resilient `load()`? HOT 1
- Feature request:DB file saving path HOT 2
- Method to read from path like routes to normal path HOT 3
- A new method to concat array on push items HOT 1
- Is there official support/no support for Sets? HOT 2
- Read/Write lock HOT 4
- Do I need to await db.save() after each push, as documented? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-json-db.