ReadableStreamDefaultReader.closed

The closed read-only property of the ReadableStreamDefaultReader interface returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors.

Syntax

var closed = readableStreamDefaultReader.closed;

Value

Examples

In this snippet, a previously-created reader is queried to see if the stream has been closed. When it is closed, the promise fulfills and the message is logged to the console.

reader.closed.then(() => {
  console.log('reader closed');
})

Specifications

Specification Status Comment
Streams
The definition of 'closed' in that specification.
Living Standard Initial definition.

Browser compatibility

BCD tables only load in the browser