TextEncoderStream: TextEncoderStream() Konstruktor

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Der TextEncoderStream() Konstruktor erstellt ein neues TextEncoderStream Objekt, das verwendet wird, um einen Strom von Zeichenketten in Bytes umzuwandeln, wobei die UTF-8-Kodierung verwendet wird.

Syntax

js
new TextEncoderStream()

Parameter

Keine.

Beispiele

In diesem Beispiel wird ein TextEncoderStream erstellt und verwendet, um einen Textstrom hochzuladen.

js
const body = textStream.pipeThrough(new TextEncoderStream());
fetch("/dest", {
  method: "POST",
  body,
  headers: { "Content-Type": "text/plain; charset=UTF-8" },
});

Spezifikationen

Specification
Encoding
# ref-for-dom-textencoderstream①

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
TextEncoderStream() constructor

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support