The encoding name (e.g., 'gbk', 'gb18030', 'big5', 'euc-jp', 'iso-2022-jp', 'shift_jis', 'euc-kr')
Optionalloose: booleanIf true, replaces unmapped bytes with replacement character instead of throwing (default: false)
A function that decodes bytes to string, with optional streaming support
Create a decoder for a supported legacy multi-byte
encoding, given its lowercased nameencoding.Returns a function
decode(arr, stream = false)that decodes bytes to a string.The returned function will maintain internal state while
stream = trueis used, allowing it to handle incomplete multi-byte sequences across multiple calls. State is reset whenstream = falseor when the function is called without thestreamparameter.