0

So I am trying to write this simple program where it just writes some text in a text file whenever I run it. And when I run it, it does write to the text file how it is supposed to, but it deletes the other content inside the text file.

here's my code:

const fs = require('fs')
const path = require('path')

const filePath = path.join(/*Text File Path*/)

const text = 'test'

fs.writeFileSync(filePath, text, 'utf-8')

0 Answers0