title: Flask send file without storing on server
body: <p>I want the user to be able to download a txt file that contains results of a sql query. I've seen answers speaking about using <code>send_file</code> or <code>Response</code> but all of those answers seem to require that I have the file stored?</p>
  
  <p>Currently I have:</p>
  
  <pre><code>@RateRevisionEndorsements_blueprint.route('/_getEndorsements', methods = ['GET'])
  def get_endorsements():
      guid = request.args.get('guid')
  
  
      client = Client()
  
      # Save query results    
      result = client.getEndorsementFile(bookGuid = guid)
  
  
      with open('tesult.txt', 'w') as r:
          for i in result:
              r.write(i)
  
      return send_file("result.txt", as_attachment=True)
  </code></pre>
  
  <p>The button to generate this route works and I have no issue receiving the query results (currently stored as a list but I can make it whatever works best), but I receive the error  <code>FileNotFoundError: [Errno 2] No such file or directory: 'C"\\..\\app\\result.txt'</code>
  Which makes me think that I need it to have stored somewhere on the server to pull from.</p>