title: Sanic Python: Delete File after sending it to a client
body: <p>I'm running a Python Server with Sanic, and when a client requests a file, the server creates this file and sends it to the client. For now, I've been using middleware:
  <code>@app.listener('before_server_stop')</code>
  to cleanup those files when the server stops.</p>
  <p>Obviously, this solution is not nice, and I would prefer to clean them up immediately, after sending the response with the file to the client.
  Is there a way to do this?</p>
  <p>The code in question:</p>
  <pre><code>@app.route('/getFiles', methods=['GET'])
  async def getFiles(request):
          //create file
          if os.path.isfile(id+'.txt'):
              return await response.file(id+'.txt')
              // -&gt; best would be to delete file here 
  
  @app.listener('before_server_stop')
  //delete all files
  </code></pre>
  <p>Thanks.</p>