INNER CODE UNIT · Python
encode
Nour833/StegoForge · web/app.py:471
def encode():
try:
result, stego_bytes, carrier_name = _encode_operation(request.form, request.files)
_ = result
stem = Path(carrier_name).stem
ext = Path(carrier_name).suffix.lower()
out_name = f"{stem}_stego{ext or '.bin'}"
buf = io.BytesIO(stego_bytes)
buf.seek(0)
return send_file(
buf,
as_attachment=True,
download_name=out_name,
mimetype="application/octet-stream",
)