I'm getting to stream ytdl audio to my express server using ffmpeg but I'm always getting "Output stream closed"
there's my code
const express = require('express')
const ffmpeg = require('fluent-ffmpeg')
const ytdl = require('ytdl-core')
const app = express()
app.set('/:id', async (req, res) => {
res.set('Content-Type', 'audio/mp3')
ffmpeg(await ytdl(req.params.id, { format: 'audioonly', quality: 'highestaudio' }))
.toFormat('mp3')
.pipe(res, { end: true })
})