Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron no read data #599

Open
Hiram-Wong opened this issue Sep 23, 2024 · 0 comments
Open

electron no read data #599

Hiram-Wong opened this issue Sep 23, 2024 · 0 comments

Comments

@Hiram-Wong
Copy link

import _ from 'lodash';
import { Low } from 'lowdb';
import { JSONFileSync } from 'lowdb/node';
const STORE_PATH = join(app.getPath('userData'), 'database.json');
let defaultData = {
    tbl_setting: []
};
class LowWithLodash extends Low {
  chain = _.chain(this).get('data');
};
const adapter = new JSONFile(STORE_PATH);
const db = new LowWithLodash(adapter, defaultData);
console.log(db.chain.get('tbl_setting').castArray().value())

join(app.getPath('userData'), 'database.json') is have data,butJSONFileSyncread is undefine, uesfs.readFileSync(STORE_PATH, 'utf8') || {};can read it but not write,how to fix it

env: electron22 lowdb7.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant