How to construct the ".gz" file loaded in the vtk.js example

the .gz files are the raw bytes of your array compressed as gzip. Basically the same thing as Numpy tofile. The json metadata just describe what those bytes are.