WritableStreamDefaultWriter: desiredSize プロパティ
desiredSize
は WritableStreamDefaultWriter
インターフェイスの読み取り専用プロパティで、ストリームの内部キューを埋めるために必要な希望サイズを返します。
値
整数。 キューがいっぱいになった場合、これは負になる可能性があることに注意してください。
値は、(エラーが発生したか、中止がキューに入れられたために)ストリームに正常に書き込むことができない場合、 null
になり、ストリームが閉じられると 0
になります。
例外
TypeError
-
ライターのロックが解除されてた場合。
例
js
const writableStream = new WritableStream(
{
write(chunk) {
// ...
},
close() {
// ...
},
abort(err) {
// ...
},
},
queuingStrategy,
);
// ...
const writer = writableStream.getWriter();
// ...
// ストリームの希望サイズを返します
let size = writer.desiredSize;
仕様書
Specification |
---|
Streams # ref-for-default-writer-desired-size⑥ |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
desiredSize |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.