N
N
Nikolai2021-10-05 13:37:04
Node.js
Nikolai, 2021-10-05 13:37:04

How to convert file from UTF-8 to ANSI on nodejs?

Through fs I create a txt file, how can I then convert it to ansi?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuriy Vorobyov, 2021-10-05
@YuriyVorobyov1333

const buffer = Buffer.from(filecontent, 'latin1')
fs.writeFile('file.txt')

Source: documentation

A
Alexandroppolus, 2021-10-05
@Alexandroppolus

read as text with UTF-8 encoding, save in ANSI encoding.

L
Lynn "Coffee Man", 2021-10-05
@Lynn

https://www.npmjs.com/package/iconv-lite

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question