I created a express.js server and serve static files through it. But when try to download these files from another computer in the local network it is very slow (my internet bandwidth is 35 Mbps and it also downloads at 35 Mbps) however when I don't have internet connection and only local network connection its fast as it can get (approximately 400 Mbps or more)
var express = require('express');
var app = express();
app.use("/cloudcontents",express.static("./CloudContents"))
app.get('download/:item' , function(req, res, next) {
let item=req.params.item;
res.download("./CloudContents/"+item,item)
});
app.listen(4000, () => console.log('Listening'));
This is the code example. CloudContents folder have some static files like pictures, movies etc. when i try to request http://localhost:4000/download/movie.mp4 or get the movie as a stream from http://localhost:4000/cloudcontents/movie.mp4 and download it, it downloads really slow on local network when there is internet connection but when I'm not connected to internet it is fast. (I find this out by mistake, my ISP cut my internet connection for a while and i was testing this code and it downloaded fast but when they connected me to the internet again it become slower again)