MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / AsyncStreamedBinaryAPIResponse

Class AsyncStreamedBinaryAPIResponse

src/opencode_ai/_response.py:541–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539
540
541class AsyncStreamedBinaryAPIResponse(AsyncAPIResponse[bytes]):
542 async def stream_to_file(
543 self,
544 file: str | os.PathLike[str],
545 *,
546 chunk_size: int | None = None,
547 ) -> None:
548 """Streams the output to the given file.
549
550 Accepts a filename or any path-like object, e.g. pathlib.Path
551 """
552 path = anyio.Path(file)
553 async with await path.open(mode="wb") as f:
554 async for data in self.iter_bytes(chunk_size):
555 await f.write(data)
556
557
558class MissingStreamClassError(TypeError):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected