Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

TextEncoder

TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

interface TextEncoder extends TextEncoderCommon {
encode(input?: string): Uint8Array;
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
var TextEncoder: {
prototype: TextEncoder;
new (): TextEncoder;
}
;

§Extends

§Methods

§
encode(input?: string): Uint8Array
[src]

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

§
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
[src]

Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.