In nodejs,how to get export data(glb)?

in nodejs ,use babylonjs ,to export glb,use GLTF2Export.GLBAsync(),then use glb.glTFFiles() to get blob,but error UnhandledPromiseRejectionWarning: TypeError: dataValue.arrayBuffer is not a function, i guess reason is blob is works on webapi but does not support on nodejs

Pinging @bghgary for this one.

cc @Drigax

I’m not sure how this will work in node. I think we use a bunch of Canvas/HTML features in addition to Blob. For example, saving a texture as a PNG/JPG is a canvas feature. I’m not familiar enough with node or the canvas to know if there is a way to make it work in both environments (browser and node).

you can do like this, in nodejs,and then export glb,but could not get data,reason is GLTFData is use blob,but in nodejs isnot support

You can try to call it, but it won’t work because the glTF exporter relies on the HTML Canvas for various features as well as the Blob at the moment. We can try to remove the Blob dependency, but I’m not sure how to remove the Canvas dependency for writing textures to a png/jpg.

1 Like