encode

fun encode(input: String = definedExternally): Uint8Array(source)

Returns the result of running UTF-8's encoder.

MDN Reference