-1

I have a text file that has some strings in it. I am trying to clear it to put something else in it. What is the right code?

I have tried File.Clear() but it keeps throwing errors.

Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111

1 Answers1

0

Assuming you're using nodejs and not a browser (in a browser you have other means of persistence like localstorage, but not files), check this and remember, you use an in memory representation of the file, if you want an empty one you can create one anew, if you want to clear the contents on the disk you need to write an empty (or whatever content you need to write) on the disk.

Community
  • 1
  • 1