forked from llimllib/chrome-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IO.py
30 lines (18 loc) · 808 Bytes
/
IO.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from enum import Enum
from typing import Any, List
from base import ChromeCommand
StreamHandle = str
class read(ChromeCommand):
"""Read a chunk of the stream"""
def __init__(self, handle: "StreamHandle", offset: int=None, size: int=None):
# Handle of the stream to read.
self.handle = handle
# Seek to the specified offset before reading (if not specificed, proceed with offset following the last read).
self.offset = offset
# Maximum number of bytes to read (left upon the agent discretion if not specified).
self.size = size
class close(ChromeCommand):
"""Close the stream, discard any temporary backing storage."""
def __init__(self, handle: "StreamHandle"):
# Handle of the stream to close.
self.handle = handle