The encoding name (e.g., 'gbk', 'gb18030', 'big5', 'euc-jp', 'iso-2022-jp', 'shift_jis', 'euc-kr')
Optionaloptions: { mode?: "fatal" }Encoding options
Optionalmode?: "fatal"Encoding mode (default: 'fatal'). Currently, only 'fatal' mode is supported.
A function that encodes string to bytes
Create an encoder for a supported legacy multi-byte
encoding, given its lowercased nameencoding.Returns a function
encode(string)that encodes a string to bytes.In
'fatal'mode (default), will throw on non well-formed strings or any codepoints which could not be encoded in the target encoding.