I would like to add the byteLength method and the hasState property.
byteLength method:
Guaranteed to be faster than iconv.encode(..).length because it doesn't allocate an entire buffer.
Usecase: you might have a very long string and don't want to create a very long buffer to encode it, but you want to write that string into a binary file with a prefix byte length (maybe in 7-bit format likes this method in .NET). So you can use this method, then you encode the string gradually on its' substrings by an encoder.
hasState property:
If reading binary data to decode, or encoding to write to binary file, you might want know if the decoder or encoder has any accumulated state inside them so you can decide if there is an error or not.
I would like to add the byteLength method and the hasState property.
byteLength method:
hasState property: