{"_id":"@abdullah2993/ytdlp-nodejs","_rev":"2-43156d4658aba843851c7d10723d5258","name":"@abdullah2993/ytdlp-nodejs","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"@abdullah2993/ytdlp-nodejs","version":"0.0.1","keywords":["yt-dlp","youtube","video","download","wrapper","typescript","ytdlp","youtube downloader","ytdlp-nodejs","youtube-thumbnails","typescript","nodejs","youtube video","video","video downloader"],"author":{"name":"Rashed Iqbal"},"license":"MIT","_id":"@abdullah2993/ytdlp-nodejs@0.0.1","maintainers":[{"name":"abdullah2993","email":"a.saleem2993@gmail.com"}],"homepage":"https://github.com/iqbal-rashed/ytdlp-nodejs#readme","bugs":{"url":"https://github.com/iqbal-rashed/ytdlp-nodejs/issues"},"dist":{"shasum":"8920b15bc4b0c525273f1fc766139aaac208683e","tarball":"https://registry.npmjs.org/@abdullah2993/ytdlp-nodejs/-/ytdlp-nodejs-0.0.1.tgz","fileCount":7,"integrity":"sha512-zSKe/3zeCxwzkVn/NUhcmhON0KFArsE87GXKB3V/3433S9GUlEB4li2V6Njs+PvN+0OEqd9DpegVkhDlPof5Uw==","signatures":[{"sig":"MEUCICDHyoFqrPVzjslRPkZILzaAWDC+OkYnCzgDUykw494PAiEA9CvEri6TudeHFS7gjyD6R3pb+Wi0e053tLKsKkiDDnc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":88374},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"e628ee5049a52ec533404ec0420bbd8344fcd485","scripts":{"lint":"eslint","test":"jest","build":"tsup","format":"prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\"","prepare":"husky"},"_npmUser":{"name":"abdullah2993","email":"a.saleem2993@gmail.com"},"repository":{"url":"git+https://github.com/iqbal-rashed/ytdlp-nodejs.git","type":"git"},"_npmVersion":"10.9.2","description":"A TypeScript wrapper for the yt-dlp executable","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.3","jest":"^29.7.0","tsup":"^8.4.0","husky":"^9.1.7","eslint":"^9.23.0","globals":"^16.0.0","ts-jest":"^29.2.6","@eslint/js":"^9.23.0","typescript":"^5.8.2","@types/jest":"^29.5.14","@types/node":"^22.13.11","typescript-eslint":"^8.27.0"},"_npmOperationalInternal":{"tmp":"tmp/ytdlp-nodejs_0.0.1_1768306542166_0.3009551397424093","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@abdullah2993/ytdlp-nodejs","version":"0.1.0","description":"A TypeScript wrapper for the yt-dlp executable","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup","test":"jest","lint":"eslint","format":"prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\"","prepare":"husky"},"keywords":["yt-dlp","youtube","video","download","wrapper","typescript","ytdlp","youtube downloader","ytdlp-nodejs","youtube-thumbnails","typescript","nodejs","youtube video","video","video downloader"],"author":{"name":"Rashed Iqbal"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/abdullah2993/ytdlp-nodejs.git"},"bugs":{"url":"https://github.com/abdullah2993/ytdlp-nodejs/issues"},"devDependencies":{"@eslint/js":"^9.23.0","@types/jest":"^29.5.14","@types/node":"^22.13.11","eslint":"^9.23.0","globals":"^16.0.0","husky":"^9.1.7","jest":"^29.7.0","ts-jest":"^29.2.6","tsup":"^8.4.0","tsx":"^4.19.3","typescript":"^5.8.2","typescript-eslint":"^8.27.0"},"engines":{"node":">=16.0.0"},"_id":"@abdullah2993/ytdlp-nodejs@0.1.0","gitHead":"91abffc6476b173f5a4ecd30680b564f5c9ae7b4","homepage":"https://github.com/abdullah2993/ytdlp-nodejs#readme","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-bsWv2QAzfYnf3lVvKQVZeHP8ns2woqaf68Oi4OWv198OeYg22EAYTKVZnzicR0v+krrWJkxY7d/zjNvWaV2vSw==","shasum":"ad14443212bb9891ed00ff38577b7741327e66dc","tarball":"https://registry.npmjs.org/@abdullah2993/ytdlp-nodejs/-/ytdlp-nodejs-0.1.0.tgz","fileCount":7,"unpackedSize":88366,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abdullah2993%2fytdlp-nodejs@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD3p1di9KKKH3R2by245xQWHr9DGyLeXwXMOd4NysbURAIhAL5RAMoCXfQBT0e3Amp2fJ4u1aBK6mqzrfDcxXejr9yP"}]},"_npmUser":{"name":"abdullah2993","email":"a.saleem2993@gmail.com"},"directories":{},"maintainers":[{"name":"abdullah2993","email":"a.saleem2993@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ytdlp-nodejs_0.1.0_1768308513477_0.16152582928931936"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-13T12:15:42.077Z","modified":"2026-01-13T12:48:33.986Z","0.0.1":"2026-01-13T12:15:42.340Z","0.1.0":"2026-01-13T12:48:33.608Z"},"bugs":{"url":"https://github.com/abdullah2993/ytdlp-nodejs/issues"},"author":{"name":"Rashed Iqbal"},"license":"MIT","homepage":"https://github.com/abdullah2993/ytdlp-nodejs#readme","keywords":["yt-dlp","youtube","video","download","wrapper","typescript","ytdlp","youtube downloader","ytdlp-nodejs","youtube-thumbnails","typescript","nodejs","youtube video","video","video downloader"],"repository":{"type":"git","url":"git+https://github.com/abdullah2993/ytdlp-nodejs.git"},"description":"A TypeScript wrapper for the yt-dlp executable","maintainers":[{"name":"abdullah2993","email":"a.saleem2993@gmail.com"}],"readme":"> Important Note: Version 2 is finally here! 🎉 This is still in beta, so please feel free to submit feature requests. Found any bug? Please open an issue on our GitHub repository.\n\n# ytdlp-nodejs\n\nThis Node.js module is a wrapper for [`yt-dlp`](https://github.com/yt-dlp/yt-dlp), a powerful video downloader, that allows you to download, stream, and fetch metadata for videos from various websites. The wrapper uses system-installed `yt-dlp` and `ffmpeg` binaries and provides a simple interface for using their features directly within a Node.js environment.\n\n## Installation\n\nTo install the `yt-dlp` Node.js wrapper, run:\n\n```bash\nnpm i @abdullah2993/ytdlp-nodejs\n```\n\nThis package requires `yt-dlp` and optionally `ffmpeg` to be installed system-wide. Please install them using your system's package manager:\n\n- **yt-dlp**: `pip install yt-dlp` or via your system package manager\n- **ffmpeg**: `brew install ffmpeg` (macOS), `apt install ffmpeg` (Linux), or via your system package manager\n\n## Usage\n\n### Importing the Package\n\n```javascript\nimport { YtDlp } from '@abdullah2993/ytdlp-nodejs';\n\nconst ytdlp = new YtDlp();\n```\n\n### Downloading a Video\n\n```javascript\nasync function downloadVideo() {\n  try {\n    const output = await ytdlp.downloadAsync(\n      'https://www.youtube.com/watch?v=_AL4IwHuHlY',\n      {\n        onProgress: (progress) => {\n          console.log(progress);\n        },\n        // others args\n      }\n    );\n    console.log('Download completed:', output);\n  } catch (error) {\n    console.error('Error:', error);\n  }\n}\n\ndownloadVideo();\n```\n\n### Streaming a Video\n\n```javascript\nimport { createWriteStream } from 'fs';\n\nasync function streamVideo() {\n  try {\n    const st = createWriteStream('video.mp4');\n\n    const ytdlpStream = ytdlp.stream(\n      'https://www.youtube.com/watch?v=_AL4IwHuHlY',\n      {\n        onProgress: (progress) => {\n          console.log(progress);\n        },\n        // others args\n      }\n    );\n\n    await ytdlpStream.pipeAsync(st);\n\n    console.log('Download completed');\n  } catch (error) {\n    console.error('Error:', error);\n  }\n}\n\nstreamVideo();\n```\n\n## Class: `YtDlp`\n\n### `constructor(opt?)`\n\nThe constructor initializes the `YtDlp` object.\n\n#### Parameters:\n\n- `opt` (optional): Options to configure the paths for `yt-dlp` and `ffmpeg`.\n  - `binaryPath`: Path to the `yt-dlp` binary (optional).\n  - `ffmpegPath`: Path to the `ffmpeg` binary (optional).\n\n#### Example:\n\n```typescript\nconst ytDlp = new YtDlp({\n  binaryPath: 'path-to-yt-dlp',\n  ffmpegPath: 'path-to-ffmpeg',\n});\n```\n\n### `checkInstallationAsync(options?): Promise<boolean>`\n\nAsynchronously checks if both `yt-dlp` and optionally `ffmpeg` binaries are installed and available.\n\n#### Parameters:\n\n- `options` (optional): An object to specify if `ffmpeg` should also be checked.\n  - `ffmpeg`: If set to `true`, it checks if `ffmpeg` is installed.\n\n#### Returns:\n\n- `Promise<boolean>`: Resolves to `true` if both `yt-dlp` and `ffmpeg` are installed (if required), otherwise `false`.\n\n#### Example:\n\n```typescript\nconst isInstalled = await ytDlp.checkInstallationAsync({ ffmpeg: true });\n```\n\n### `checkInstallation(options?): boolean`\n\nSynchronously checks if both `yt-dlp` and optionally `ffmpeg` binaries are installed and available.\n\n#### Parameters:\n\n- `options` (optional): An object to specify if `ffmpeg` should also be checked.\n  - `ffmpeg`: If set to `true`, it checks if `ffmpeg` is installed.\n\n#### Returns:\n\n- `boolean`: `true` if both `yt-dlp` and `ffmpeg` are installed (if required), otherwise `false`.\n\n#### Example:\n\n```typescript\nconst isInstalled = ytDlp.checkInstallation({ ffmpeg: true });\n```\n\n### `execAsync(url, options?): Promise<string>`\n\nAsynchronously executes `yt-dlp` with the provided URL and options.\n\n#### Parameters:\n\n- `url`: The URL of the video to download or stream.\n- `options` (optional): Additional options to pass to `yt-dlp`:\n  - `onData`: A callback that is triggered when data is received from `yt-dlp`.\n  - `onProgress`: An callback function to track progess of downloading.\n\n#### Returns:\n\n- `Promise<string>`: Resolves to the output of the `yt-dlp` command.\n\n#### Example:\n\n```typescript\nconst result = await ytDlp.execAsync(\n  'https://www.youtube.com/watch?v=exampleVideoID'\n);\n```\n\n### `exec(url, options?): ChildProcess `\n\nSynchronously executes `yt-dlp` with the provided URL and options.\n\n#### Parameters:\n\n- `url`: The URL of the video to download or stream.\n- `options` (optional): Additional options to pass to `yt-dlp`.\n\n#### Returns:\n\n- `ChildProcess`: The spawned child process running `yt-dlp`.\n  - `on('progress')`: An event to track progess of downloading.\n\n#### Example:\n\n```typescript\nconst ytDlpProcess = ytDlp.exec(\n  'https://www.youtube.com/watch?v=exampleVideoID'\n);\n```\n\n### `download(url, options?): ChildProcess`\n\nDownloads a video from the given URL.\n\n#### Parameters:\n\n- `url`: The URL of the video to download.\n- `options` (optional): Additional options for downloading, such as video format.\n  - `format`: String | [Format Options](#format-options).\n\n#### Returns:\n\n- `ChildProcess`: The spawned child process running `yt-dlp`.\n  - `on('progress')`: An event to track progess of downloading.\n\n#### Example:\n\n```typescript\nytDlp.download('https://www.youtube.com/watch?v=exampleVideoID', {\n  format: 'bestvideo+bestaudio',\n});\n```\n\n### `downloadAsync(url, options?): Promise<string>`\n\nAsynchronously downloads a video from the given URL.\n\n#### Parameters:\n\n- `url`: The URL of the video to download.\n- `options` (optional): Additional options for downloading, such as video format and a progress callback.\n  - `format`: String | [Format Options](#format-options).\n  - `onProgress`: An callback function to track progess of downloading.\n  - `output`: String | Custom output path and filename template. Uses [yt-dlp output template syntax](https://github.com/yt-dlp/yt-dlp#output-template). For example: `\"./downloads/%(title)s.%(ext)s\"`.\n\n#### Returns:\n\n- `Promise<string>`: Resolves to the output of the `yt-dlp` command.\n\n#### Example:\n\n```typescript\nconst result = await ytDlp.downloadAsync(\n  'https://www.youtube.com/watch?v=exampleVideoID',\n  {\n    format: 'bestvideo+bestaudio',\n  }\n);\n```\n\n### `stream(url, options?): PipeResponse`\n\nStreams a video from the given URL.\n\n#### Parameters:\n\n- `url`: The URL of the video to stream.\n- `options` (optional): Additional options for streaming, such as video format and a progress callback.\n  - `format`: String | [Format Options](#format-options).\n  - `onProgress`: An callback function to track progess of downloading.\n\n#### Returns:\n\n- `pipe`: A function that pipes the stream to a writable stream.\n- `pipeAsync`: A function that pipes the stream asynchronously to a writable stream.\n\n#### Example:\n\n```typescript\nconst ytdlpStream = ytDlp.stream(\n  'https://www.youtube.com/watch?v=exampleVideoID'\n);\nytdlpStream.pipe(destinationStream);\n```\n\n### `getInfoAsync(url, options?): Promise<VideoInfo | PlaylistInfo>`\n\nFetches detailed information about a video asynchronously.\n\n#### Parameters:\n\n- `url`: The URL of the video.\n- `options` (optional): InfoOptions\n  Additional options to control the fetching behavior:\n\n  - `flatPlaylist`?: `boolean` (default: `true`) |\n    If `true`, returns a flat list with limited information for playlist items.\n    If `false`, fetches full information for each video in the playlist.\n\n  - `cookies`?: `string` |\n    A raw cookie header string to be used for authenticated requests.\n\n  - `cookiesFromBrowser`?: `string` |\n    Uses cookies retrieved from the specified browser profile.\n\n  - `noCookiesFromBrowser`?: `boolean` |\n    If true, disables automatically retrieving cookies from the browser.\n\n  - `noCookies`?: `boolean` |\n    If true, disables the use of all cookies entirely (overrides other cookie options).\n\n#### Returns:\n\n- `Promise<VideoInfo | PlaylistInfo>`: Resolves to a `VideoInfo` or `PlaylistInfo` object containing metadata about the video.\n\n#### Example:\n\n```typescript\nconst info = await ytDlp.getInfoAsync('url');\nif (info._type == 'video') {\n  console.log(info); // VideoInfo\n}\nif (info._type == 'playlist') {\n  console.log(info); // PlaylistInfo\n}\n```\n\n### `getThumbnailsAsync(url): Promise<VideoThumbnail[]>`\n\nFetches all available thumbnails for a video asynchronously.\n\n#### Parameters:\n\n- `url`: The URL of the video.\n\n#### Returns:\n\n- `Promise<VideoThumbnail[]>`: Resolves to an array of `VideoThumbnail` objects.\n\n#### Example:\n\n```typescript\nconst thumbnails = await ytDlp.getThumbnailsAsync(\n  'https://www.youtube.com/watch?v=exampleVideoID'\n);\n```\n\n### `getTitleAsync(url): Promise<string>`\n\nFetche title for a video asynchronously.\n\n#### Parameters:\n\n- `url`: The URL of the video.\n\n#### Returns:\n\n- `Promise<string>`: Resolves to a string.\n\n#### Example:\n\n```typescript\nconst title = await ytDlp.getTitleAsync(\n  'https://www.youtube.com/watch?v=exampleVideoID'\n);\n```\n\n### `getFileAsync(url, options?): Promise<File>`\n\nReturns a `File` object containing the video/audio data without saving it to disk.\n\n#### Parameters:\n\n- `url`: The URL of the video.\n- `options` (optional): Additional options for getting the file:\n  - `format`: String | [Format Options](#format-options)\n  - `filename`: Custom filename for the resulting file\n  - `metadata`: Custom metadata for the file:\n    - `name`: File name\n    - `type`: MIME type\n    - `size`: File size in bytes\n  - `onProgress`: A callback function to track progress of downloading\n\n#### Returns:\n\n- `Promise<File>`: Resolves to a `File` object containing the video/audio data.\n\n#### Example:\n\n```typescript\nconst file = await ytdlp.getFileAsync(\n  'https://www.youtube.com/watch?v=exampleVideoID',\n  {\n    format: {\n      filter: 'audioandvideo',\n      type: 'mp4',\n      quality: 'highest',\n    },\n    filename: 'custom-video.mp4',\n    onProgress: (progress) => {\n      console.log(progress);\n    },\n  }\n);\n```\n\n# Format Options\n\n`filter:` \"videoonly\" | \"audioonly\" | \"audioandvideo\" | \"mergevideo\"\n\n- `filter: \"videoonly\"`\n\n  - `quality:` \"2160p\" |\n    \"1440p\" |\n    \"1080p\" |\n    \"720p\" |\n    \"480p\" |\n    \"360p\" |\n    \"240p\" |\n    \"144p\" |\n    \"highest\" |\n    \"lowest\" (default: 'highest')\n  - `type:` \"mp4\" | \"webm\" (default:'mp4')\n\n- `filter: \"audioonly\"`\n\n  - `quality:` \"highest\" | \"lowest\" (default:'highest')\n\n- `filter: \"audioandvideo\"`\n\n  - `quality:` \"highest\" | \"lowest\" (default:'highest')\n  - `type:` \"mp4\" | \"webm\" (default:'mp4')\n\n- `filter: \"audioonly\"`\n\n  - `quality:` 0 to 10 (default:5)\n  - `type:` \"aac\" | \"flac\" | \"mp3\" | \"m4a\" | \"opus\" | \"vorbis\" | \"wav\" | \"alac\" (default:'mp3')\n\n- `filter: \"mergevideo\"`\n  - `quality:` \"2160p\" |\n    \"1440p\" |\n    \"1080p\" |\n    \"720p\" |\n    \"480p\" |\n    \"360p\" |\n    \"240p\" |\n    \"144p\" |\n    \"highest\" |\n    \"lowest\" (default: 'highest')\n  - `format:` \"mkv\" | \"mp4\" | \"ogg\" | \"webm\" | \"flv\" (default:'mp4')\n\n## Contributing\n\nContributions are welcome! Feel free to submit a pull request or open an issue on GitHub.\n","readmeFilename":"readme.md"}