Skip to content
Advertisement

Tag: appendfile

How to append to a file in Node?

I am trying to append a string to a log file. However writeFile will erase the content each time before writing the string. Any idea how to do this the easy way? Answer For occasional appends, you can use appendFile, which creates a new file handle each time it’s called: Asynchronously: Synchronously: But if you append repeatedly to the same

Advertisement