A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/API/TextDecoderStream/TextDecoderStream below:

TextDecoderStream: TextDecoderStream() コンストラクター - Web API

TextDecoderStream: TextDecoderStream() コンストラクター

Baseline Widely available

TextDecoderStream() コンストラクターは、新しい TextDecoderStream オブジェクトを生成します。これは、あるバイナリーエンコーディングのテキストのストリームを文字列に変換するために使用します。

構文
new TextDecoderStream(label)
new TextDecoderStream(label, options)
引数
label

文字列で、既定値は utf-8 です。 何れかの有効なラベルにすることができます。

options 省略可

次のプロパティを持つオブジェクトです。

fatal

論理値で、このオブジェクトが無効なデータをデコードした場合に TypeError を発生させる必要があるかどうかを示します。 既定値では false であり、これはデコードする際に不正なデータを置換文字で置き換えることを意味します。

例外
RangeError

label の値が未知の場合、または 'replacement' デコードアルゴリズム("iso-2022-cn" または "iso-2022-cn-ext")につながる値のいずれかである場合に発生します。

例

次の例は、fetch() の呼び出しから取得したバイナリーデータをデコードする方法を示しています。 このデータには label が渡されていないので、UTF-8 として解釈されます。

const response = await fetch("https://example.com");
const stream = response.body.pipeThrough(new TextDecoderStream());
仕様書 ブラウザーの互換性

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4