-1

I basically need to write in a text file with JS, but like when i write on it i want it to go on the next line and write smth, not overwriting the old text.

How it shouldn't be : file before changing w script

ENTER TEXT HERE

file after changing w script

AISDIJAISJIASJD

. . .

How it should be :

file before changing w script

ENTER TEXT HERE

file after changing w script

ENTER TEXT HERE
KNdANANSNDASDKL
0rb
  • 19
  • 5

1 Answers1

0

you can use nodejs appendFile

const fs = require('fs');

fs.appendFileSync('file.txt', 'adasdasd\n');