This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The ready getter 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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support5916 No No46 ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support595916 No46 ? ?

Document Tags and Contributors

Contributors to this page: connorshea, FloraFauna, chrisdavidmills, abbycar, jpmedley
Last updated by: connorshea,