How to load a GLB file from data


Hi! (and oops, I posted this just now in the archive site without realizing you moved)

I’d like to know the best approach for loading a GLB file from a string/arraybuffer/blob/whatever. The reason I’d like to do this is that I need to save the scene as zip (along with additional non-3D files (which I did and was surprisingly easy). Now I’m reimporting from the same zip, and have only the data to work with. I haven’t seen any examples that work this low level. I’ve only seen generic loading from a URI or file event. Does anyone have any examples, or know a good approach?

thank you!



Oh, dang, nevermind. I was scouring through GLTF2Loader, and didn’t see the GLTFFileLoader one level up. It magically works now!

const loader = new BABYLON.GLTFFileLoader();
loader.loadAsync(myscene, buffer, ‘data:’, null, ‘filename.glb’).then( function(x) {.

1 Like


haha! Welcome and congrats on your self answer :smiley:

1 Like