TextDecoderStream

Encoding API 接口的 TextDecoderStream 方法将二进制编码(如 UTF-8 等)的文本流转换为字符串流。它与 TextDecoder 的流形式等价。

构造函数

TextDecoderStream()

创建一个新的 TextDecoderStream 对象。

属性

TextDecoderStream.encoding只读

一种编码。

TextDecoderStream.fatal只读

一个 boolean,表示错误是否是致命的。

TextDecoderStream.ignoreBOM只读

一个 boolean,表示是否忽略字节顺序标记。

TextDecoderStream.readable只读

返回此对象控制的 ReadableStream 实例。

TextDecoderStream.writable只读

返回此对象控制的 WritableStream 实例。

示例

规范

Specification
Encoding
# interface-textdecoderstream

浏览器兼容性

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
TextDecoderStream
TextDecoderStream() constructor
encoding
fatal
ignoreBOM
readable
writable

Legend

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

Full support
Full support
Partial support
Partial support
Has more compatibility info.

参见