From 02aeb0a751dce80fac1bfca31b6f736558953b77 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 10:12:37 +0200 Subject: refactor(node): move uploads out of webrtc_server UploadMixin in transport/webrtc/upload_handlers.py, with the upload cap; _upload_chunk moved unchanged, _append_chunk joins webrtc/disk.py. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py') diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py index bc8d33f..2e484de 100644 --- a/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py +++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py @@ -74,3 +74,9 @@ def _read_and_encrypt( f.seek(chunk_index * CHUNK_SIZE) plaintext = f.read(CHUNK_SIZE) return file_chunk_wire(gek, plaintext, chunk_index, file_hash, file_id) + + +def _append_chunk(tmp_path: Path, chunk_bytes: bytes, first: bool) -> None: + """Add one chunk to a partial upload. Blocking; called through `off_disk`.""" + with open(tmp_path, "wb" if first else "ab") as f: + f.write(chunk_bytes) -- cgit v1.2.3