MCPcopy Create free account
hub / github.com/Roy3838/Observer / _write_file

Function _write_file

api/messaging.py:315–327  ·  view source on GitHub ↗

Decode and write the input video. Runs in a thread: up to ~15MB of base64.

(path: Path, video_b64: str, max_size_mb: float)

Source from the content-addressed store, hash-verified

313
314
315def _write_file(path: Path, video_b64: str, max_size_mb: float) -> None:
316 """Decode and write the input video. Runs in a thread: up to ~15MB of base64."""
317 video_data = base64.b64decode(video_b64)
318
319 # Check file size
320 file_size_mb = len(video_data) / (1024 * 1024)
321 if file_size_mb > max_size_mb:
322 raise HTTPException(
323 status_code=400,
324 detail=f"Video too large ({file_size_mb:.1f}MB). Maximum allowed: {max_size_mb}MB"
325 )
326
327 path.write_bytes(video_data)
328
329
330async def _save_temp_video(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected