ByteLengthQueuingStrategy
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2019.
Note: This feature is available in Web Workers.
Giao diện ByteLengthQueuingStrategy của Streams API cung cấp một chiến lược xếp hàng theo độ dài byte dựng sẵn, có thể được dùng khi khởi tạo stream.
Bộ khởi tạo
ByteLengthQueuingStrategy()-
Tạo một thể hiện đối tượng
ByteLengthQueuingStrategymới.
Thuộc tính thể hiện
ByteLengthQueuingStrategy.highWaterMarkRead only-
Tổng số byte có thể được chứa trong hàng đợi nội bộ trước khi backpressure được áp dụng.
Phương thức thể hiện
ByteLengthQueuingStrategy.size()-
Trả về thuộc tính
byteLengthcủa chunk đã cho.
Ví dụ
js
const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1024 });
const readableStream = new ReadableStream(
{
start(controller) {
// …
},
pull(controller) {
// …
},
cancel(err) {
console.log("stream error:", err);
},
},
queueingStrategy,
);
const size = queueingStrategy.size(chunk);
Thông số kỹ thuật
| Specification |
|---|
| Streams> # blqs-class> |