How can retrieve my exports as a compressed archive

How to retrieve a scene export of many files from Babylon.js as a compressed archive?

I am currently using @babylonjs/serializers and currently for gltf and glb. I will come to obj too soon, I may need some more examples for it. But currently I need compression.

I have coded like that:

GLTF2Export.GLTFAsync(this.scene, scene_name, {})
		.then((gltf) => {
		    console.log("GTLTFAsync gltf: ", gltf)

How can make it download as a compressed archive like zip or else if possible?
Do I have to pass the gltf to another external library? Can babylonjs handle this task itself?

Are you looking for BABYLON.GLTF2Export.GLBAsync ? this will give you a single glb file.

GLB file format is a binary form of glTF that includes textures instead of referencing them as external images.

No. I use it too. I wonder if a compression like zip tar gzip is possible by babylon.js.

I see, I don’t think babylon lets you do this out of the box but you should be able to access the blobs after the gltf is created then use jsZip (JSZip) or other similar lib to compress the blob.

This should let you iterate over the blob for each file
BABYLON.GLTF2Export.GLTFAsync(scene, “test”).then((t)=>{
for(var key in t.glTFFiles){
var x = t.glTFFiles[k]

Hope this helps.

1 Like

Actually I would do the same nust wondered can I avoid adding another lib to load to project if babylonjs addresses this.
It seems not, so jszip.

Thanks a lot.

1 Like