code: def stream_to_handler(self, request_handler):
          
          written = 0
          while written < self.length:
              # Reading chunk_size at a time minimizes buffering.
              f = self._framework.yieldable(self.read(self.chunk_size))
              yield f
              chunk = f.result()
  
              # write() simply appends the output to a list; flush() sends it
              # over the network and minimizes buffering in the handler.
              request_handler.write(chunk)
              request_handler.flush()
              written += len(chunk)
docs: Write the contents of this file to a
          :class:`tornado.web.RequestHandler`. This method calls
          :meth:`~tornado.web.RequestHandler.flush` on
          the RequestHandler, so ensure all headers have already been set.
          For a more complete example see the implementation of
          :class:`~motor.web.GridFSHandler`.
  
          .. code-block:: python
  
              class FileHandler(tornado.web.RequestHandler):
                  @tornado.web.asynchronous
                  @gen.coroutine
                  def get(self, filename):
                      db = self.settings['db']
                      fs = yield motor.MotorGridFSBucket(db())
                      try:
                          gridout = yield fs.open_download_stream_by_name(filename)
                      except gridfs.NoFile:
                          raise tornado.web.HTTPError(404)
  
                      self.set_header("Content-Type", gridout.content_type)
                      self.set_header("Content-Length", gridout.length)
                      yield gridout.stream_to_handler(self)
                      self.finish()
  
          .. seealso:: Tornado `RequestHandler <http://tornadoweb.org/en/stable/web.html#request-handlers>`_