let data= {
timestamp:time,
OSName:osname,
IP:userdata.IPv4,
country:userdata.country_name,
browser:broname
}
I want to store these values into a JSON file or js file, so that I can fetch them later on. Please help me with this, how can I store them? Also, these value update every time when page reload; then a new object should be made.
NodeJS has his own lib for this, fs (Docs).
You need to import it (I used Vanilla JS, for more general solution)
const fs = require('fs');
And then you can use writeFileSync to save it (Docs)
In your case, you would need to do something like this:
fs.writeFileSync(<filename>, JSON.stringify(<yourObject>));