npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@choewy/yt-dlp

v1.1.0

Published

Node.js/TypeScript wrapper for yt-dlp with automatic binary installation and ffmpeg-static integration

Readme

@choewy/yt-dlp

A Node.js / TypeScript wrapper for yt-dlp.

This package runs a platform-specific yt-dlp binary and uses ffmpeg-static by default.


Features

  • Fluent builder API
  • Download video as file, buffer, or stream
  • Fetch thumbnail URL
  • Built-in yt-dlp binary (auto-installed)
  • Built-in FFmpeg (ffmpeg-static)
  • Fully typed API
  • Debug mode support

Installation

npm install @choewy/yt-dlp
pnpm add @choewy/yt-dlp

pnpm users

This package requires install scripts.

pnpm approve-builds

Approve:

  • @choewy/yt-dlp
  • ffmpeg-static

Quick Start

import { YtDlp } from '@choewy/yt-dlp';

const result = await new YtDlp({
  url: 'https://www.youtube.com/watch?v=VIDEO_ID',
})
  .mergeFormat('mp4')
  .video()
  .download();

console.log(result.path);

Examples

Download video (file)

const result = await new YtDlp({ url }).mergeFormat('mp4').output('./video.mp4').video().download();

Download as buffer

const { buffer } = await new YtDlp({ url }).mergeFormat('mp4').video().buffer();

Download as stream

import { createWriteStream } from 'fs';

const { stream } = await new YtDlp({ url }).mergeFormat('mp4').video().stream();

stream.pipe(createWriteStream('./video.mp4'));

Extract audio

const result = await new YtDlp({ url }).audioOnly().audioFormat('mp3').output('./audio.%(ext)s').video().download();

Get thumbnail URL

const thumbnail = await new YtDlp({ url }).thumbnail().url();

Custom FFmpeg

new YtDlp({ url }).ffmpeg('/usr/local/bin/ffmpeg').video().download();

API

new YtDlp(options)

new YtDlp({
  url: string,
});

Builder Methods

All methods are chainable.

ytDlp
  .url(url)
  .format(format)
  .output(path)
  .mergeFormat('mp4')
  .audioOnly()
  .audioFormat('mp3')
  .ffmpeg(path)
  .quiet()
  .noWarnings()
  .noProgress()
  .retries(3)
  .fragmentRetries(3)
  .concurrentFragments(4)
  .debug(true);

Configuration Options

| Option | Type | Default | Description | | --------------------- | -------------------------- | --------------- | ----------------------------------------- | | url | string | required | Target media URL | | ffmpeg | string | ffmpeg-static | Path to ffmpeg binary | | format | string | mp4 optimized | yt-dlp format selector | | output | string | - | Output path or template (-o) | | playlist | boolean | false | Download playlist instead of single video | | mergeFormat | 'mp4' \| 'mkv' \| 'webm' | mp4 | Merge container format | | audioOnly | boolean | false | Extract audio only (-x) | | audioFormat | 'mp3' \| 'm4a' \| 'wav' | - | Audio format | | overwrite | boolean | true | Overwrite existing files | | quiet | boolean | true | Suppress output logs | | noWarnings | boolean | true | Suppress warnings | | noProgress | boolean | true | Disable progress output | | restrictFilenames | boolean | false | Use ASCII filenames only | | paths | string | - | Base output directory | | retries | number | 3 | Retry count | | fragmentRetries | number | 3 | Fragment retry count | | concurrentFragments | number | 4 | Parallel fragment downloads | | embedThumbnail | boolean | false | Embed thumbnail into media | | convertThumbnail | 'jpg' \| 'png' \| 'webp' | - | Convert thumbnail format | | printJson | boolean | false | Output metadata as JSON | | debug | boolean | false | Print yt-dlp stdout/stderr |


Video API

ytDlp.video();

download()

{
  origin: string;
  title: string;
  path: string;
}

buffer()

{
  origin: string;
  title: string;
  buffer: Buffer;
}

stream()

{
  origin: string;
  title: string;
  stream: Readable;
}

Thumbnail API

ytDlp.thumbnail().url();

Returns:

Promise<string | null>;

Constraints

  • url is required
  • output is required for .download()
  • audioOnly and mergeFormat should not be used together
  • FFmpeg must exist

Architecture

YtDlp
 ├─ YtDlpConfig
 ├─ YtDlpArgsBuilder
 ├─ YtDlpRunner
 ├─ YtDlpVideo
 └─ YtDlpThumbnail

Debug Mode

new YtDlp({ url }).debug(true).video().download();

Development

pnpm install
pnpm approve-builds
pnpm build
pnpm test

License

MIT License


Note

Recommended for stable MP4 downloads:

new YtDlp({ url }).mergeFormat('mp4').video().download();