vtk.js: reading gzipped, binary STLs with vtkSTLReader


I’m using vtk.js to read in and display locally stored STL files in the browser, which so far is working great for binary STLs. It works for reading/displaying remotely stored files as well, but the file size can be quite big.

var read = vtkSTLReader.newInstance();
read.setUrl( stl_url , { binary:true }).then(  update.bind(2, i, map), vdErrHandler.bind(2, i)  ) ;

Gzipping binary STLs gives me files which are ~half the size, so I am curious if such files can be read in with vtk.js? Any sort of hints in how to do so? I’ve looked into the source code, but I don’t have enough of a software background to understand it well enough. The following command yields no console warnings/errors, but also does not load any files. Anyone have any tips/advice? Or is this perhaps not a supported functionality?

read.setUrl( stl_url.gz , { compression:'gz', binary:true }).then(  update.bind(2, i, map), vdErrHandler.bind(2, i)  ) ;

Ok, through testing different methods, it seems ASCII STL can be loaded as gzip, by simply specifying compression:‘gz’. Is it a bug that this compression flag doesn’t work for binary files? Or perhaps user error in how I am setting the compression and binary options?

read.setUrl( stl_ascii_url.gz , { compression:'gz' }).then(  update.bind(2, i, map), vdErrHandler.bind(2, i)  ) ;

probably the decompression pass may not be implemented for the binary branch.