1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
2
Based on the send_file() function, am I right that you're using Flask? If the files are small, it might be easier to just keep the file in memory (using get_object()) rather than downloading it to the server's filesystem. For example, something like:
s3_result = s3.get_object(Bucket='bucket', Key='key') response = make_response(s3_result['Body'].read()) response.headers['Content-Disposition'] = 'attachment; filename=myfile.txt' response.mimetype = 'text/plain' # or whatever the MIME type is of your file return response
If the files are large, you could instead redirect the user to a presigned url (which you can generate using boto3).
respondido há 2 anos
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 2 anos