I'm trying to code an Application that's able to download YouTube-Videos in multiple formats. Everything is ok, except for getting the progress in percentage, I don't want the app to call a custom server by a request to get it. I'm using the ytdl-core JavaScript-Library.
I've thought of getting the current filesize and creating a loading effect by listening for the pipes state (IsWriting, IsCancelled) but how exacly do i do that? Here's the pipe:
...().pipe(fs.createWriteStream(path));
You must use the .on('progress') event. There is a working example: progress.js