W3cubDocs

/Web APIs

ReadableStream: locked property

The locked read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.

A readable stream can have at most one active reader at a time, and is locked to that reader until it is released. A reader might be obtained using ReadableStream.getReader() and released using the reader's releaseLock() method.

Value

A boolean value indicating whether or not the readable stream is locked.

Examples

js

const stream = new ReadableStream({
  // ...
});

const reader = stream.getReader();

stream.locked;
// should return true, as the stream has been locked to a reader

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
locked 52 14 65 No 39 10.1 52 52 65 41 10.3 6.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/locked