MCPcopy Index your code
hub / github.com/microsoft/playwright-python / save_as

Method save_as

playwright/_impl/_stream.py:28–37  ·  view source on GitHub ↗
(self, path: Union[str, Path])

Source from the content-addressed store, hash-verified

26 super().__init__(parent, type, guid, initializer)
27
28 async def save_as(self, path: Union[str, Path]) -> None:
29 file = await self._loop.run_in_executor(None, lambda: open(path, "wb"))
30 while True:
31 binary = await self._channel.send("read", None, {"size": 1024 * 1024})
32 if not binary:
33 break
34 await self._loop.run_in_executor(
35 None, lambda: file.write(base64.b64decode(binary))
36 )
37 await self._loop.run_in_executor(None, lambda: file.close())
38
39 async def read_all(self) -> bytes:
40 binary = b""

Callers

nothing calls this directly

Calls 2

sendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected