|
16 | 16 | from .constants import DEFAULT_WS_URL
|
17 | 17 | from .control import set_control
|
18 | 18 | from .event_queue import EventQueue
|
19 |
| -from .file_ops import upload, upload_file |
| 19 | +from .file_ops import download, download_file, upload, upload_file |
20 | 20 | from .pins import pin_listen, pin_read
|
21 | 21 | from .protocol_types import EventMessage, ResponseMessage
|
22 | 22 | from .serial import monitor_lines, write_serial
|
@@ -93,6 +93,28 @@ async def upload_file(
|
93 | 93 | """
|
94 | 94 | return await upload_file(self._transport, filename, local_path)
|
95 | 95 |
|
| 96 | + async def download(self, name: str) -> ResponseMessage: |
| 97 | + """ |
| 98 | + Download a file from the simulator. |
| 99 | +
|
| 100 | + Args: |
| 101 | + name: The name of the file to download. |
| 102 | +
|
| 103 | + Returns: |
| 104 | + The response message from the server. |
| 105 | + """ |
| 106 | + return await download(self._transport, name) |
| 107 | + |
| 108 | + async def download_file(self, name: str, local_path: Optional[Path] = None) -> None: |
| 109 | + """ |
| 110 | + Download a file from the simulator and save it to a local path. |
| 111 | +
|
| 112 | + Args: |
| 113 | + name: The name of the file to download. |
| 114 | + local_path: The local path to save the downloaded file. If not provided, uses the name as the path. |
| 115 | + """ |
| 116 | + await download_file(self._transport, name, local_path) |
| 117 | + |
96 | 118 | async def start_simulation(
|
97 | 119 | self,
|
98 | 120 | firmware: str,
|
|
0 commit comments