electron-storage
electron-storage copied to clipboard
Not a Valid JSON file when suing get method.
Hi there. I get this error on macOS.
var data = new Object();
data.name = name;
data.address = address;
storage.set('customers.json', data)
.then(() => {
console.log('Data saved successfully!')
})
.catch((err) => {
console.log(err);
});
It writes to the file but then when I use the get function,
var oldData = storage.get('customers.json')
.then(d => {
console.log(d);
})
.catch(err => {
console.log(err);
});
It gives me that the error.
And here is what the console gives:
Error: The file in path /Users/syncster31/Library/Application Support/ASMS/customers.json is not a valid json file at /Users/syncster31/Documents/Programming/Electron/my-app/node_modules/electron-storage/dist/index…:37 at tryToString (fs.js:449) at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436)
@alexiusacademia Same error. How did you solved it ? Thks
Same error on mac
I didn't. I wrote my own library electron-db.