ReadableStreamBYOBReader: releaseLock() method

Baseline 2026 *
Newly available

Since March 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

* Some parts of this feature may have varying levels of support.

Note: This feature is available in Web Workers.

The releaseLock() method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active.

The reader will appear errored if the associated stream is errored when the lock is released; otherwise, the reader will appear closed.

If the reader's lock is released while it still has pending read requests then the promises returned by the reader's ReadableStreamBYOBReader.read() method are immediately rejected with a TypeError. Unread chunks remain in the stream's internal queue and can be read later by acquiring a new reader.

Syntax

js
releaseLock()

Parameters

None.

Return value

None (undefined).

Exceptions

TypeError

Thrown if the source object is not a ReadableStreamBYOBReader.

Examples

A trivial examples is shown below. A lock is created as soon as the reader is created on the stream.

js
const reader = stream.getReader({ mode: "byob" });
reader.releaseLock();

Specifications

Specification
Streams
# ref-for-byob-reader-release-lock②

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
releaseLock
Chrome – Full support
Chrome 89 (Release date: 2021-03-02)
footnote Full support
Edge – Full support
Edge 89 (Release date: 2021-03-04)
footnote Full support
Firefox – Full support
Firefox 102 (Release date: 2022-06-28)
footnote Full support
Opera – Full support
Opera 75 (Release date: 2021-03-24)
footnote Full support
Safari – Full support
Safari 26.4 (Release date: 2026-03-24)
footnote Full support
Chrome Android – Full support
Chrome Android 89 (Release date: 2021-03-02)
footnote Full support
Firefox for Android – Full support
Firefox for Android 102 (Release date: 2022-06-28)
footnote Full support
Opera Android – Full support
Opera Android 63 (Release date: 2021-04-16)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26.4 (Release date: 2026-03-24)
footnote Full support
Samsung Internet – Full support
Samsung Internet 15 (Release date: 2021-08-13)
footnote Full support
WebView Android – Full support
WebView Android 89 (Release date: 2021-03-02)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26.4 (Release date: 2026-03-24)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.16 (Release date: 2021-11-08)
footnote Full support
Node.js – Full support
Node.js 16.5 (Release date: 2021-07-14)
footnote Full support
releaseLock() rejects pending read requests
Chrome – Full support
Chrome 105 (Release date: 2022-09-02)
footnote
footnote Before version 105, releaseLock() throws instead of rejecting.
Edge – Full support
Edge 105 (Release date: 2022-09-01)
footnote
footnote Before version 105, releaseLock() throws instead of rejecting.
Firefox – Full support
Firefox 102 (Release date: 2022-06-28)
footnote Full support
Opera – Full support
Opera 91 (Release date: 2022-09-14)
footnote
footnote Before version 91, releaseLock() throws instead of rejecting.
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 105 (Release date: 2022-09-02)
footnote
footnote Before version 105, releaseLock() throws instead of rejecting.
Firefox for Android – Full support
Firefox for Android 102 (Release date: 2022-06-28)
footnote Full support
Opera Android – Full support
Opera Android 72 (Release date: 2022-10-21)
footnote
footnote Before version 72, releaseLock() throws instead of rejecting.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 20 (Release date: 2023-02-10)
footnote
footnote Before version 20.0, releaseLock() throws instead of rejecting.
WebView Android – Full support
WebView Android 105 (Release date: 2022-09-02)
footnote
footnote Before version 105, releaseLock() throws instead of rejecting.
WebView on iOS – No support
WebView on iOS
footnote No support
Bun – No support
Bun
footnote No support
Deno – Full support
Deno 1.18 (Release date: 2022-01-20)
footnote Full support
Node.js – Full support
Node.js 18.9 (Release date: 2022-09-08)
footnote Full support

Legend

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

Full support
Full support
No support
No support
See implementation notes.

See also