G
G
getaxe2022-02-11 07:53:18
JavaScript
getaxe, 2022-02-11 07:53:18

How to force require to write a variable again?

There's a problem with the variable cache where the code just doesn't read it again until it's reloaded.
I need that every time (conditionally, when interacting with the button, it accesses the json file and sees if there is data there). And he writes them down for the first time when they are empty, then he writes down when the information appeared there, but when the information is removed from the file, he stops overwriting it, and just remembers what was.
ps This is for ds bot, and the command is used very rarely, no need to write about the load.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2022-02-11
@getaxe

You don't have to want it. There are corresponding methods for reading files https://nodejs.org/api/fs.html
In particular readFile/readFileSync

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question