Closed shennan closed 2 years ago
Apologies, I've just seen that you actually need to write the data yourself if there is no file.
So...
if (db.data === null) {
db.data = {}
await db.write()
}
This then creates the file, with the empty object.
This is a departure from V1 where I believe the adapter took care of that part? Closing the issue.
The title pretty much says it all. When I was using V1, I remember LowDB creating a file if it didn't exist. But perhaps I got that wrong?
Anyway, my current V3 code does not seem to create the file passed to JSONFile adapter:
Should V3 write the file? Am I wrong in thinking V1 wrote the file?