I want to send multiple files to the user per response. For example the user requests the index site, and the site needs some .png´s, the css and so on.
The user only get a package with all he needs. Thats the idea.
So my idea is that it will be realize in something like this way:
res.writeHead(200, {'Content-Type': 'text/html'});
var content = fs.readFileSync(applicationPath + "index.html");
res.write(content);
content = fs.readFileSync(applicationPath + "images/logo.png");
res.write(content);
content = fs.readFileSync(applicationPath + "index.css");
res.write(content);
res.end();
Is this possible in any way? Or are there other solutions for that?
Thank you for your help and answers!
If you want to display just html, css, images just use any templating lang like ejs, pug and if just want the user to download them when visit just add them to archive you can simply use something like JSZip any other lib to make you archive then add required headers like content-disposition and others to make user download it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With