1 Respuesta
- Más nuevo
- Más votos
- Más comentarios
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 hace 2 años
Contenido relevante
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace 4 meses
- OFICIAL DE AWSActualizada hace 8 meses