GLTF2Export.GLBAsync to specific folder

Hey guys. Would it be possible to somehow save this glb to a specific folder, instead of default downloads folder? If not, what could be my alternatives?

image

Hey hey! :smiley: The downloadFiles function uses the technique of creating a DOM link and clicking on it through code: Babylon.js/glTFData.ts at 775c5462e74665f18d7447b906639e298046a132 · BabylonJS/Babylon.js · GitHub, and it seems that this behavior is controlled by the browser, not the user: : The Anchor element - HTML: HyperText Markup Language | MDN (mozilla.org).

One alternative could be to create a different function that downloads using the File System API, but iirc that doesn’t work in all browsers, and the user has to give permission: The File System Access API: simplifying access to local files (web.dev)

Okay. Managed to figure it out. If anyone encounters same scenario in the future, this is my solution. I’ve created a File object on the front and sent the data to the node.js server, where I created a write stream and stored it at the specific location.

// on the front-end
image

// on the back-end
image

On the server side, you also need to add middleware for processing request body as a Buffer.

image

Turned out to be fairly simple, but it gave me a lot of headache till this point xD

Thanks for your answer @carolhmj, appreciate it.

Cheers

1 Like