Gio.PollableInputStream.prototype.is_readable

function is_readable(): Boolean {
    // Gjs wrapper for g_pollable_input_stream_is_readable()
}
  

Checks if stream can be read.

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

Since 2.28

Returns

true if stream is readable, false if not. If an error has occurred on stream, this will result in Gio.PollableInputStream.prototype.is_readable returning true, and the next attempt to read will return the error.