You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexpress=require('express');constpath=require('path');constfs=require('fs');constapp=express();app.get('/rickroll.mp3',(req,res)=>{constfilePath=path.join(__dirname,'rickroll.mp3');fs.stat(filePath,(err,stats)=>{if(err){console.error('Error while getting file stats:',err);res.status(500).send('Error while getting file stats.');return;}res.setHeader('Content-Type','audio/mpeg');res.setHeader('Content-Disposition','attachment; filename="rickroll.mp3"');res.setHeader('Content-Length',stats.size);res.setHeader('Accept-Ranges','bytes');res.sendFile(filePath,(err)=>{if(err){console.error('Error while sending the file:',err);res.status(500).send('Error while sending the file.');}});});});constport=process.env.PORT||3000;app.listen(port,()=>{console.log(`Server is running on port ${port}`);});
The text was updated successfully, but these errors were encountered:
so i have a webserver in express.js that serves some custom audio files that i want to use on etched tho i get everytime this error:
the server code is this:
The text was updated successfully, but these errors were encountered: