awsgi
awsgi copied to clipboard
Is there any way to download a file from s3?
I want to implements a download feature, when user request to download, lambda will get file content from s3, then response to api gateway. Note: I want to download a binary file, eg: xxx.bin
Here is the code:
file = s3.get_file_content(bucket_name, key)
response = make_response(file['Body'].read())
response.headers.set('Content-Type', 'application/octet-stream')
response.headers.set(
'Content-Disposition', 'attachment', filename='%s' % key)
return response
But i got some error:
