Sample CLI
gway vbox stream-file-response
Full Code
def stream_file_response(path: str, filename: str) -> HTTPResponse:
"""Return a proper file download response that bypasses HTML templating."""
headers = {
'Content-Type': 'application/octet-stream',
'Content-Disposition': f'attachment; filename="{filename}"',
}
with open(path, 'rb') as f:
body = f.read()
return HTTPResponse(body=body, status=200, headers=headers)