TextDecoderStream
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2022.
Note: This feature is available in Web Workers.
Giao diện TextDecoderStream của Encoding API chuyển đổi một luồng văn bản trong mã hóa nhị phân, chẳng hạn UTF-8, thành một luồng chuỗi.
Đây là phiên bản streaming tương đương với TextDecoder.
Nó triển khai hình dạng tương tự như TransformStream, cho phép sử dụng trong ReadableStream.pipeThrough() và các phương thức tương tự.
Hàm khởi tạo
TextDecoderStream()-
Tạo một đối tượng
TextDecoderStreammới.
Thuộc tính phiên bản
TextDecoderStream.encodingRead only-
Mã hóa được sử dụng.
TextDecoderStream.fatalRead only-
Giá trị
booleancho biết chế độ lỗi có phải là fatal hay không. TextDecoderStream.ignoreBOMRead only-
Giá trị
booleancho biết byte order mark có bị bỏ qua hay không. TextDecoderStream.readableRead only-
Trả về phiên bản
ReadableStreamđược kiểm soát bởi đối tượng này. TextDecoderStream.writableRead only-
Trả về phiên bản
WritableStreamđược kiểm soát bởi đối tượng này.
Ví dụ
Thông số kỹ thuật
| Specification |
|---|
| Encoding> # interface-textdecoderstream> |
Tương thích trình duyệt
Xem thêm
TextEncoderStreamTextDecoderTransformStream- Streams API Concepts
- Experimenting with the Streams API
- Streaming requests with the fetch API, developer.chrome.com (2020)