encodeInto method

TextEncoderEncodeIntoResult encodeInto(
  1. String source,
  2. JSUint8Array destination
)

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. This is potentially more performant than the older encode() method — especially when the target buffer is a view into a Wasm heap.

Implementation

external TextEncoderEncodeIntoResult encodeInto(
  String source,
  JSUint8Array destination,
);