Read/WriteFile keeps rolling back in node
glugau (0)

Hi everyone,

I'm building a discord bot, and I save data to a JSON file.
The problem is that it appears that the data sometimes rolls back to an older value, and I think it is because of repl.it.

I read files with fs.ReadFileSync(), then I edit the data and I write with fs.WriteFile().

I want to point out that it works most of the time, but then it suddenly rolls back to an old version, which defeats the purpose of the bot which is to store the amount of messages a user sent (it is for a small server so I don't feel like I need a database)

Thank you for any help!

You are viewing a single comment. View All
ErrorNoInternet (20)

@19wintersp Is there a way to setup multiple databases for 1 REPL?