Skip to content

TextEncoder

Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:1484

The TextEncoder interface takes a stream of code points as input and emits a stream of UTF-8 bytes.

MDN Reference

new TextEncoder(): TextEncoder

Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:1485

TextEncoder

readonly encoding: string

Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:1498

encode(input?): Uint8Array

Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:1491

The TextEncoder.encode() method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.

MDN Reference

string

Uint8Array


encodeInto(input, buffer): TextEncoderEncodeIntoResult

Defined in: .pnpm-home/store/v11/links/@cloudflare/workers-types/4.20251118.0/2891147a4db443bf13ca098dcb7381fb6bac5793758b7fd187ebaf5bc0deb969/node_modules/@cloudflare/workers-types/index.ts:1497

The TextEncoder.encodeInto() method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.

MDN Reference

string

Uint8Array

TextEncoderEncodeIntoResult