diff --git a/index.js b/index.js index 8ce5bf7..35dd228 100644 --- a/index.js +++ b/index.js @@ -53,8 +53,11 @@ app.get("/download", async (req, res) => { } } - if (format in ["mp3", "ogg", "wav"]) { + if ("mp3 ogg wav".includes(format)) { var audio = ytdl(url, { filter: 'audioonly', quality: quality }) + + res.setHeader('Content-Disposition', `attachment; filename="${filename}.${formats[format] || format}"`); + audio.pipe(res) } else if (defin == "hd") {