Answer the question
In order to leave comments, you need to log in
FS without repeats?
How to enter text into a file without repetition?
fs.appendFile('d:\\a\\logs.txt', `[${today}] [${displaytime}] `+message.toString()+"\n", err => {
if (err) {
console.error(err)
return
}
})
Answer the question
In order to leave comments, you need to log in
Create the string you want to write.
Read the file line by line comparing the lines with the created one.
If there are matches, then do nothing, otherwise write the line to the file.
Believe that in the process the neighboring process did not write anything to the file (if there are several processes)
Or, as suggested in the comments, take any database, the same sqlite.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question