IO

Input/Output operations for streams produced by DevTools.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.io.StreamHandle

This is either obtained from another method or specifed as blob:<uuid> where <uuid&gt is an UUID of a Blob.

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.io.close(handle)

Close the stream, discard any temporary backing storage.

Parameters:handle (StreamHandle) – Handle of the stream to close.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.io.read(handle, offset=None, size=None)

Read a chunk of the stream

Parameters:
  • handle (StreamHandle) – Handle of the stream to read.
  • offset (Optional[int]) – (Optional) Seek to the specified offset before reading (if not specificed, proceed with offset following the last read). Some types of streams may only support sequential reads.
  • size (Optional[int]) – (Optional) Maximum number of bytes to read (left upon the agent discretion if not specified).
Return type:

Generator[Dict[str, Any], Dict[str, Any], Tuple[Optional[bool], str, bool]]

Returns:

A tuple with the following items:

  1. base64Encoded - (Optional) Set if the data is base64-encoded
  2. data - Data that were read.
  3. eof - Set if the end-of-file condition occured while reading.

cdp.io.resolve_blob(object_id)

Return UUID of Blob object specified by a remote object id.

Parameters:object_id (RemoteObjectId) – Object id of a Blob object wrapper.
Return type:Generator[Dict[str, Any], Dict[str, Any], str]
Returns:UUID of the specified Blob.

Events

There are no events in this module.