Package Exports
- @mrlvn/easy-dl
- @mrlvn/easy-dl/dist/lib.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mrlvn/easy-dl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
easy-dl
A simple and flexible library downloader for audio and video using yt-dlp and ffmpeg.
Supports both Node.js and Bun.
📦 Installation
Using NPM
npm install @mrlvn/easy-dlUsing BUN
bun add @mrlvn/easy-dlUsing YARN
yarn add @mrlvn/easy-dlUsing PNPM
pnpm add @mrlvn/easy-dl🚀 Usage
CommonJS
const download = require("@mrlvn/easy-dl");ESModule or TypeScript
import download from "@mrlvn/easy-dl";📚 Examples
import download from "@mrlvn/easy-dl";
(async() => {
// Example 1: Video as Buffer
const videoBuffer = await download("https://youtu.be/dQw4w9WgXcQ", { type: "video" });
// Example 2: Audio to File
await download("https://youtu.be/dQw4w9WgXcQ", {
type: "audio",
output: "rickroll.mp3"
});
// Example 3: With Cookies
await download("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
type: "video",
output: "video.mp4",
cookies: "./cookies.txt"
});
})();⚙️ Options (DownloadOptions)
| Option | Type | Default | Description |
|---|---|---|---|
mode |
"audio" | "video" |
"audio" |
Choose whether to download audio or video. |
format |
string? |
auto | Output format (mp3, mp4, flac, etc). |
quality |
string? |
best |
Quality setting (e.g. 320k, 1080p, best). |
output |
string? |
undefined |
If provided, saves output to this file. If omitted, returns a Buffer. |
cookies |
string? |
undefined |
Path to cookies file (Netscape/Chrome format) for authenticated downloads. |
📜 License
This project is licensed under the MIT License.
See the LICENSE file for details.