Our great sponsors
-
to download the youtube video locally, we use the go-to package for that task, ytdl-core.
-
To convert local videos to GIFs we will use ffmpeg.wasm which is essentially a Webassembly port of FFmpeg. So you can think of this process as using FFmpeg inside node asynchronously to do the conversion. no spawning external processes, no dependent tools ...etc which is very powerful and simple.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
Putting it all together as well as adding a cli progress by with cli-progress the ConversionService looks like this
-
a function downloadVideo() is responsible for this, it takes the youtube video url/id and returns a ReadableStream that we can use to save the video file locally as well as its extension i.e: mp4, avi..etc
Related posts
- How to convert Node.js stream callback functions into an Async Iterator
- Buffered vs Streaming Data Transfer
- pipesAreFun
- Also keep in mind that a one line module always is more than one line of code
- Also keep in mind that a one line module always is more than one line of code. It's documentation, tests, and history in the repo.