Reputation: 93
I'm using fs module to log my node.js app, and I don't find on google how to do a linebreak with fs for a text file...
I've tried some fs.append with nothing in it and it just doesn't make anything.
Thanks in advance, ~TBD
EDIT : I'm using .txt file to enable fast log reading...
Upvotes: 0
Views: 622
Reputation: 26
It would be great to have some sample code to show for further help, but normally the code would look like this:
//Suggesting you are using ES6, if not, change all 'const' to 'var'
const fileSystem = require('fs');
//Change the data below, the path and data, but not the \n. There might be problems when using \n, if it occurs, consider changing it to \r.
fileSystem.writeFileSync('./path/to/your/file.txt', 'yourdata\n');
See: \n or \r
Upvotes: 1