
Lightweight Node.js module that downloads a YouTube video and converts it to MP3 via ffmpeg-static, no system FFmpeg required
A lightweight Node.js utility module (no UI) that downloads the audio stream from any YouTube URL using @distube/ytdl-core and converts it to an MP3 file via fluent-ffmpeg backed by a bundled ffmpeg-static binary. Exported as convertToMp3(url, options) returning a Promise<string> with the absolute output path. Configurable output directory, filename, and bitrate.
Zero-dependency-install YouTube-to-MP3 Node.js module.
• API: convertToMp3(url, { outputDir, filename, bitrate }) → Promise<string>; isValidYouTubeUrl(url) → boolean.
• Audio download: @distube/ytdl-core streams audio-only from YouTube.
• Encoding: fluent-ffmpeg pipes the stream through libmp3lame; bitrate defaults to 128 kbps.
• FFmpeg: bundled via ffmpeg-static; no system-level installation required.
• Error handling: throws typed errors for invalid URLs, failed video info fetch, download failure, and conversion failure.
• Tests: Jest suite covering valid/invalid URL handling and conversion.