INNER CODE UNIT · Python
_stream
Nour833/StegoForge · web/app.py:387
def _stream():
yield _json_sse({"type": "info", "text": "Validating encode request..."})
try:
result, stego_bytes, carrier_name = _encode_operation(request.form, request.files)
yield _json_sse({"type": "info", "text": "Embedding complete, preparing artifact..."})
ext = Path(carrier_name).suffix or ".bin"
artifact = _persist_artifact(stego_bytes, ext)
download_name = f"{Path(carrier_name).stem}_stego{ext}"
payload = {
"type": "success",
"text": "Encode completed",
"result": result,
"artifact": artifact,
"download_name": download_name,
}
yield _json_sse(payload)