I am getting an error while trying to return from a nested function in javascript. After the execution of let after = YD.on("finished", async function (err, done) {return done;});
I want to get the value of "done" in "after". But it is returning some other values. Can anybody help me with this please. Thank you in advance.
async function downloadVideo(videoID) {
let YD = new YoutubeMp3Downloader({
ffmpegPath: "/usr/local/bin/ffmpeg",
outputPath: "./public/assets/",
youtubeVideoQuality: "lowest",
queueParallelism: 2,
progressTimeout: 2000,
});
YD.download(videoID, `${videoID}.mp3`);
let after = YD.on("finished", async function (err, done) {return done;});
console.log(after);
}
downloadVideo("lTTajzrSkCw");