Reputation: 728
I created in my Linux PC a simple app that generates TXT files using fs
NodeJS command. But I need read those files with an external Window app. So I need those files in ANSI encode. I installed Wine and for now, I open the file with notepad and save it again to convert the codification.
There is any way to generate the TXT files with ANSI encoding from NodeJS directly?
Upvotes: 1
Views: 9012
Reputation: 728
I solved my question like this:
let txtContent = '' // string with content to save as file
const buffer = Buffer.from(txtContent, 'latin1')
fs.writeFile('files/file_name.txt')
Upvotes: 2