This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The ready read-only property of the WritableStreamDefaultWriter interface returns a Promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.


var promise = defaultWriter.ready


A Promise.


The following example shows two uses of the ready property. The first uses ready to ensure that the WritableStream is done writing and thus able to receive data before sending a binary chunk. The second also checks whether the the WritableStream is done writing, but this time because the writing must be finished before the writer can be closed.

function sendMessage(message, writableStream) {
  // defaultWriter is of type WritableStreamDefaultWriter
  var defaultWriter = writableStream.getWriter();
  var encoder = new TextEncoder();
  var encoded = encoder.encode(message, {stream: true});
  encoded.forEach(function(chunk) {
    // Make sure the stream and its writer are able to
    //   receive data.
    .then(function() {
      .then(function() {
        console.log("Chunk written to sink.);
      .catch(function(err) {
        console.log("Chunk error: " + err);
    // Call ready again to ensure that all chunks are written
    //   before closing the writer.
    .then(function() {
      .then(function() {
        console.log("All chunks written");
      .catch(function(err) {
        console.log("Stream error: " + err);


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

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 58 ? ? 45 ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support 58 58 ? ? ? 45 ?

Document Tags and Contributors

 Contributors to this page: jpmedley
 Last updated by: jpmedley,