code: def _start_streaming_pcap(self):
          
  
          if os.path.exists(self.capture_file_path):
              try:
                  os.remove(self.capture_file_path)
              except OSError as e:
                  raise aiohttp.web.HTTPConflict(text="Could not delete old capture file '{}': {}".format(self.capture_file_path, e))
  
          try:
              stream_content = yield from self.read_pcap_from_source()
          except aiohttp.web.HTTPException as e:
              error_msg = "Could not stream PCAP file: error {}: {}".format(e.status, e.text)
              log.error(error_msg)
              self._capturing = False
              self._project.notification.emit("log.error", {"message": error_msg})
              self._project.controller.notification.emit("link.updated", self.__json__())
  
          with stream_content as stream:
              try:
                  with open(self.capture_file_path, "wb") as f:
                      while self._capturing:
                          # We read 1 bytes by 1 otherwise the remaining data is not read if the traffic stops
                          data = yield from stream.read(1)
                          if data:
                              f.write(data)
                              # Flush to disk otherwise the live is not really live
                              f.flush()
                          else:
                              break
              except OSError as e:
                  raise aiohttp.web.HTTPConflict(text="Could not write capture file '{}': {}".format(self.capture_file_path, e))
docs: Dump a pcap file on disk