// LocalStorage is a lowdb adapter for saving to localStorage
const adapter = new LocalStorage('db')
// Create database instance
const db = low(adapter)
// Set default state
db.defaults({ items: [] })
.write()
Now how it can be saved where it's hosted like in './maindb.json'
?
Is there anything available like FileSync?
Update
after realising there no way that client can access server filesystem. I probably asked a wrong question. but there is a solution using fetch. so if anyone has ans please put it down I am trying my best.
index.html -> fetch(jsonObj) -> post -> save.php-> creates maindb.json/updates.
index.html -> fetch() -> get -> save.php -> returns from maindb.json.