Exporting a GLB model out of three.js that is in an Electron application:

I am not even sure if exporting out of THREE in an Electron app is possible.

I cannot find any other instances of people trying it and having issues. My code, I believe is the most up to date as of right now that should work and it does work in the examples on the THREE site.

And this exact code has worked in a stand alone THREE deployment on a site. So I am thinking I am missing something having to do with it being embedded in an Electron app.

Here is my code.

The *exportButton *is a html button the page/window that is referencing the THREE code.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//    Export the model
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
exportButton.addEventListener('click', download);

//exportButton.click = 
function download() 
{
    const exporter = new THREE.GLTFExporter();

    exporter.parse(
        scene,
        function (result) {
            console.log(result);
            saveArrayBuffer(result, 'scene.glb');
        },
        function ( error ) {
        console.log( 'An error happened' );
        },
        { 
            binary: true 
        }
    );
}

function saveString( text, filename ) 
{
    save( new Blob( [ text ], { type: 'text/plain' } ), filename );
}

function saveArrayBuffer(buffer, filename) 
{
    save(new Blob([buffer], { type: 'application/octet-stream' }), filename);
    //save(new Blob([buffer]), filename);
}

const link = document.createElement('a');
link.style.display = 'none';
document.body.appendChild(link); // Firefox workaround, see #6594 

function save(blob, filename) 
{
    link.href = URL.createObjectURL(blob);
    link.download = filename;
    link.click();

    // URL.revokeObjectURL( url ); breaks Firefox...
}