INNER CODE UNIT · Python

_persist_artifact

Nour833/StegoForge · web/app.py:40

def _persist_artifact(data: bytes, suffix: str = ".bin") -> str:
    suffix = suffix if suffix.startswith(".") else f".{suffix}"
    with tempfile.NamedTemporaryFile(prefix=ARTIFACT_PREFIX, suffix=suffix, delete=False) as tmp:
        tmp.write(data)
        tmp.flush()
        return tmp.name


def _is_video_name(name: str) -> bool:
    ext = Path(name).suffix.lower()
    return ext in {".mp4", ".webm"}


def _is_video_method(method: str | None) -> bool:
    return method in {"video-dct", "video-motion"}


# Magic bytes → (mime, extension)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…