Interface TextEncoder
interface TextEncoder {
encoding: string;
encode(input?: string): Uint8Array;
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
encoding: string;
encode(input?: string): Uint8Array;
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
Hierarchy
- TextEncoderCommon
- TextEncoder (view full)
Index
Properties
Methods
Methods
encode
- encode(input?): Uint8Array
Returns the result of running UTF-8's encoder.
Parameters
Optional
input: string
Returns Uint8Array
encodeInto
- encode
Into (source, destination): TextEncoderEncodeIntoResult 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.
Parameters
- source: string
- destination: Uint8Array
Returns TextEncoderEncodeIntoResult
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.
MDN Reference