Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118063

Zip an audio file In NodeJS with archiver in fly

$
0
0

I use node-youtube-dl to have a stream to download a video and I want to convert it to mp3 using fluent-ffmmpeg. I also want to zip this mp3 audio to send to the client to download it but I cannot figure how to zip the mp3 audio. I find every corner of StackOverflow but I did not find any solution. Please help me! Thanks

const stream = youtubedl(url);
const videoTitle = await youtube.getVideoTitle(url);
const converter = new ffmpeg({ source: stream });
const zip = archiver('zip'); // This does not work since converter.toFormat('mp3') is not a stream
zip.append(converter.toFormat('mp3'), { name: `${videoTitle}.${toFormat}`
});
zip.finalize();

I really appreciate if you can help me! Thanks again


Viewing all articles
Browse latest Browse all 118063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>