NodeJS + Express JS with Gz file

1.1k views Asked by At

I'm trying to create a server to serve my Unity3d WebGL game.

My problem come from those request from the webgl game.

            dataUrl: "Release/build.data",
            codeUrl: "Release/build.js",
            asmUrl: "Release/build.asm.js",
            memUrl: "Release/build.mem",

My NodeJS server need to return those file but they are as buid.datagz, buidl.jsgz, etc

so i did :

app.use('/Release/build.asm.js', function (req: express.Request, res: express.Response) {
    res.contentType('application/x-javascript');
    res.sendFile(clientFolder + '/Release/build.asm.jsgz');
});

it work as the server return the file but it's still gzipped,

so how do i tell NodeJS / Express to unzip the file before sending them?

0

There are 0 answers