see https module license import 'fast-text-encoding' ; import { ModuleRpcUtils } from '../../../utils' ; const textEncoder = new ( ModuleRpcUtils . isRunUnderNode ( ) ? require ( 'util' ) . TextEncoder : TextEncoder ) ( ) ; const textDecoder = new ( ModuleRpcUtils . isRunUnderNode ( ) ? require ( 'util' ) . TextDecoder : TextDecoder ) ( 'utf-8' ) ; /**
 * Encode a string to UTF-8 bytes.
 */ export function encodeUtf8 ( str ) { return textEncoder . encode ( str ) ; } /**
 * Decode an array of UTF-8 bytes to a string.
 */ export function decodeUtf8 ( bytes ) { return textDecoder . decode ( bytes ) ; }