Gio.PollableOutputStream.prototype.is_writable

function is_writable(): Boolean {
    // Gjs wrapper for g_pollable_output_stream_is_writable()
}
  

Checks if stream can be written.

Note that some stream types may not be able to implement this 100% reliably, and it is possible that a call to Gio.OutputStream.prototype.write after this returns true would still block. To guarantee non-blocking behavior, you should always use Gio.PollableOutputStream.prototype.write_nonblocking, which will return a Gio.IOErrorEnum.would_block error rather than blocking.

Since 2.28

Returns

true if stream is writable, false if not. If an error has occurred on stream, this will result in Gio.PollableOutputStream.prototype.is_writable returning true, and the next attempt to write will return the error.