Hello!
How do I save the information within a textfile to a string?
Currently I am trying to use this:
This sadly doesn't work well, primarly since I don't know what the "data" is, I just saw it somewhere and said wth and tried it without any expectations...
Regardless, in the same folder as index.html, there is a file named note.txt.
And in this note is some lines of text, and I would like to save this text to a string.
Then I want to display this string in a messagebox.
And I only need to know how to get the text into a string format. The rest I know 🙂
How do I save the information within a textfile to a string?
Currently I am trying to use this:
JavaScript:
data = ""
fs.readFile("note.txt", 'utf8', (data) => {
console.log(data)
result = data;
});
console.log(result)
This sadly doesn't work well, primarly since I don't know what the "data" is, I just saw it somewhere and said wth and tried it without any expectations...
Regardless, in the same folder as index.html, there is a file named note.txt.
And in this note is some lines of text, and I would like to save this text to a string.
Then I want to display this string in a messagebox.
And I only need to know how to get the text into a string format. The rest I know 🙂