lowdb

const Low = require('lowdb');

class SyncAdapter {
    read() {return {}}//初始化为对象才能db.defaults
    write(data) { /* ... */ } // should return nothing
}

const adapter = new SyncAdapter();
const db = new Low(adapter);


// Set some defaults
db.defaults({ posts: [1], user: {} }).write();
console.log(db.get('posts').value() );

 

posted on 2022-06-22 03:36  xsSystem  阅读(20)  评论(0编辑  收藏  举报