其他分享
首页 > 其他分享> > lowdb

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() );

 

标签:const,db,SyncAdapter,write,lowdb,defaults,Low
来源: https://www.cnblogs.com/xsSystem/p/16399053.html