@app.route('/')
def index():
strIO = StringIO.StringIO()
strIO.write('Hello from Dan Jacob and Stephane Wirtel !')
strIO.seek(0)
return send_file(strIO,
attachment_filename="testing.txt",
as_attachment=True)
in above code, we can use StringIO to avoid use temp file when download, but when the file is very large, we can find that the memory of this process is increasing if we download many times, and the memory will not decrease.
anyone know how to fix this problem? thx!