@classmethod
  def _WriteOutputFile(cls, curr, to_stream):
    out_dn = curr.out_dn
    header = lab_common.ChunkHeader('o%d' % curr.index)
    header.out_ = curr.header.out_
    if not curr.header.is_tar_:
      out_fns = os.listdir(out_dn)
      if not out_fns:
        header.is_absent_ = True
        lab_common.SendChunk(header, None, to_stream)
        return
      # We created this out_dn path via Mkdir, so it's valid.
      fn = (os.path.join(out_dn, out_fns[0]) if len(out_fns) == 1 else None)
      if fn and os.path.isfile(fn):
        with open(fn, 'rb') as fp:
          data = fp.read(MAX_READ)
          if not data:
            lab_common.SendChunk(header, None, to_stream)
          else:
            while data:
              lab_common.SendChunk(header, data, to_stream)
              data = fp.read(MAX_READ)
        return
    header.is_tar_ = True
    lab_common.SendTar(out_dn, '/', header, to_stream)
Write an output file to the response stream.
dataset/ETHPy150Open google/lab_device_proxy/lab_device_proxy_server.py/LabDeviceProxyRequestHandler._WriteOutputFile