Node.js module to get system encoding.
When executing terminal commands using Node.js, the output results are garbled on some non-English language Windows systems. This library uses the chcp command on Windows to obtain the system encoding, which can then be converted to the corresponding language using the iconv-lite library.
pnpm add sys-encoding
import { getSystemEncoding } from 'sys-encoding';
import { decode } from 'iconv-lite';
const encoding = getSystemEncoding();
console.log(decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), encoding)); // If encoding is 'win1251'