[vtkjs] Get download progress with vtkXMLPolyDataReader.setUrl?

Is there any way to get the download progress, ideally as a percentage, when using vtkXMLPolyDataReader.setUrl? Since the dataset my app downloads is relatively large, I would like to display this information to the user.

My code looks like:

const reader = vtkXMLPolyDataReader.newInstance();
const promise = reader.setUrl(this.vtpURI).then(() => {
  // set up actor, mapper, …
}

My javascript knowledge is quite basic, but I guess the download progress can be accessed somewhere in this promise thing, right? Any suggestion is welcome.

You can monitor progress via a callback using an optional argument on the setURL method.

1 Like

Thanks! Exactly what I needed.