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

Function _write_file

api/messaging.py:316–328  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected