INNER CODE UNIT · Python

_cleanup_old_artifacts

Nour833/StegoForge · web/app.py:104

def _cleanup_old_artifacts(max_age_seconds: int = 3600):
    """Delete web artifact temp files older than max_age_seconds."""
    import time
    now = time.time()
    tmp_dir = Path(tempfile.gettempdir())
    for f in tmp_dir.glob(f"{ARTIFACT_PREFIX}*"):
        try:
            if now - f.stat().st_mtime > max_age_seconds:
                f.unlink(missing_ok=True)
        except OSError:
            pass


def _encode_operation(form, files) -> tuple[dict, bytes, str]:
    carrier_file = files.get("carrier")
    payload_file = files.get("payload")
    key = form.get("key", "")
    method = form.get("method", None) or None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…