sys-encoding
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

sys-encoding

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.

Installation

pnpm add sys-encoding

Usage

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'

Readme

Keywords

Package Sidebar

Install

npm i sys-encoding

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

12.1 kB

Total Files

6

Last publish

Collaborators

  • wtto00