Skip to main content
TextEncoder.prototype.encode - util - Node documentation
method TextEncoder.prototype.encode

Usage in Deno

import { TextEncoder } from "node:util";
TextEncoder.prototype.encode(input?: string): Uint8Array

UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes.

Parameters

optional
input: string = 'an empty string'

The text to encode.

Return Type

Uint8Array