{"_id":"@bestie/m3u8-downloader","name":"@bestie/m3u8-downloader","dist-tags":{"latest":"0.3.2"},"versions":{"0.3.2":{"name":"@bestie/m3u8-downloader","version":"0.3.2","description":"m3u8 downloader ","homepage":"https://github.com/ibesty/m3u8-downloader","type":"module","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","typings":"dist/index.d.ts","keywords":["m3u8","hlsdownloader","m3u8-downloader","live"],"author":{"name":"ibesty"},"license":"MIT","engines":{"node":">=18"},"dependencies":{"axios":"^1.7.4","axios-retry":"^4.4.2","fluent-ffmpeg":"^2.1.3","fs-extra":"^11.2.0","m3u8-parser":"^7.1.0","p-queue":"^8.0.1","tiny-typed-emitter":"^2.1.0"},"devDependencies":{"@types/express":"^4.17.21","@types/fluent-ffmpeg":"^2.1.27","@types/fs-extra":"^11.0.4","@types/node":"22.0.0","@vitest/coverage-v8":"^2.0.4","express":"^4.19.2","rimraf":"^6.0.1","tslib":"^2.6.3","tsx":"^4.16.2","typescript":"^5.5.4","vitest":"^2.0.4"},"scripts":{"dev":"tsc -w","build":"pnpm run typecheck && pnpm run test &&  rimraf dist && tsc","typecheck":"tsc --noEmit -p tsconfig.json","release":"pnpm run build && pnpm publish --access=public","test":"vitest run","test:watch":"vitest","coverage":"vitest run --coverage"},"_id":"@bestie/m3u8-downloader@0.3.2","_integrity":"sha512-RFKMYuxgiiKl9t+DOrIULol3FeZJTFbBzIwLwlBPVGQmrZpxfiHaGskSd/6K0zB6TLHk5H3psRU9jzj+Qe7jrQ==","_resolved":"/private/var/folders/19/8kn18r3j60s6lyftz8wc1cqr0000gn/T/e63d3ca8db6d16b1792c934e9c815315/bestie-m3u8-downloader-0.3.2.tgz","_from":"file:bestie-m3u8-downloader-0.3.2.tgz","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-RFKMYuxgiiKl9t+DOrIULol3FeZJTFbBzIwLwlBPVGQmrZpxfiHaGskSd/6K0zB6TLHk5H3psRU9jzj+Qe7jrQ==","shasum":"b54fc46bb9020a8de79e704e0244c139ef8df81d","tarball":"https://registry.npmjs.org/@bestie/m3u8-downloader/-/m3u8-downloader-0.3.2.tgz","fileCount":7,"unpackedSize":21090,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOUV3hLWaQTS9rjRlcKSUpdXfO4uqlqikq4BaA7OMoTAIhAJHzec3sFU31v3G+FXiQol02glR4RQC0a9kNQ/ompdi6"}]},"_npmUser":{"name":"bestie","email":"npm@tangkunhou.com"},"directories":{},"maintainers":[{"name":"bestie","email":"npm@tangkunhou.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/m3u8-downloader_0.3.2_1737284545568_0.5034612350416572"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-19T11:02:25.473Z","0.3.2":"2025-01-19T11:02:25.828Z","modified":"2025-01-19T11:02:26.163Z"},"maintainers":[{"name":"bestie","email":"npm@tangkunhou.com"}],"description":"m3u8 downloader ","homepage":"https://github.com/ibesty/m3u8-downloader","keywords":["m3u8","hlsdownloader","m3u8-downloader","live"],"author":{"name":"ibesty"},"license":"MIT","readme":"# M3U8Downloader\n\n\n> fork from https://github.com/renmu123/m3u8-downloader\n> 1. add axios proxy support\n> 2. replace ffmpeg with fluent-ffmpeg\n\n\nM3U8Downloader is a tool for downloading and merging M3U8 video segments. It supports concurrent downloads, retry mechanisms, and can merge downloaded TS segments into a single file, with an option to convert to MP4 format.\n\n<p >\n  <a href=\"https://codecov.io/github/renmu123/m3u8-downloader\" ><img src=\"https://codecov.io/github/renmu123/m3u8-downloader/graph/badge.svg?token=08MBSCPIMF\"/></a>\n</p>\n\n## Features\n\n- Concurrent downloading of M3U8 video segments\n- Automatic retry on download failure\n- Support for stop, resume, cancel function\n- Merging TS segments into a single file\n- Optional conversion of TS files to MP4 format\n\n## Installation\n\nInstall using npm:\n\n```bash\nnpm install @renmu/m3u8-downloader\n```\n\n## Usage\n\n### Initialization\n\n```typescript\nimport M3U8Downloader from \"@renmu/m3u8-downloader\";\n\n// download ts segments and convert to single ts file\nconst downloader = new M3U8Downloader(\n  \"https://example.com/path/to/playlist.m3u8\",\n  \"/path/output.ts\", // ts ext\n  {\n    convert2Mp4: false,\n  }\n);\n\n// download ts segments and convert to single mp4 file\nconst downloader = new M3U8Downloader(\n  \"https://example.com/path/to/playlist.m3u8\",\n  \"/path/output.mp4\", // mp4 ext\n  {\n    convert2Mp4: true,\n    ffmpegPath: \"/usr/local/bin/ffmpeg\",\n  }\n);\n\n// download ts segments\nconst downloader = new M3U8Downloader(\n  \"https://example.com/path/to/playlist.m3u8\",\n  \"anything\",\n  {\n    mergeSegments: false,\n    segmentsDir: outputDir, // the directory to store downloaded segments\n  }\n);\n```\n\n### Options\n\n```js\n/**\n * @param m3u8Url M3U8 URL\n * @param options\n * @param options.concurrency Number of segments to download concurrently\n * @param options.segmentsDir directory to store downloaded segments,default: system temp dir\n * @param options.mergeSegments Whether to merge downloaded segments into a single file\n * @param options.convert2Mp4 Whether to convert2Mp4 downloaded segments into a single file, you must open mergeSegments\n * @param options.ffmpegPath Path to ffmpeg binary if you open convert2Mp4\n * @param options.retries Number of retries for downloading segments\n * @param options.clean Whether to clean up downloaded segments after download is error or canceled\n * @param options.headers Axios headers to be sent with the HTTP request\n * @param options.proxy Axios proxy configuration object\n * */\n```\n\n### Start Download\n\n```typescript\ndownloader.download();\n```\n\n### Pause Download\n\n```typescript\ndownloader.pause();\n```\n\n### Resume Download\n\n```typescript\ndownloader.resume();\n```\n\n### Cancel Download\n\n```typescript\ndownloader.cancel();\n```\n\n## Event Listeners\n\nM3U8Downloader extends from `EventEmitter`, and you can listen to the following events:\n\n- `start` - Download started\n- `progress` - Download progress\n- `paused` - Download paused\n- `resumed` - Download resumed\n- `canceled` - Download canceled\n- `completed` - Download completed\n- `converted` - Conversion completed\n- `error` - Error occurred\n\nExample:\n\n```typescript\ndownloader.on(\"progress\", progress => {\n  console.log(`Download progress: ${progress.downloaded}/${progress.total}`);\n});\n\ndownloader.on(\"completed\", () => {\n  console.log(\"Download completed\");\n});\n\ndownloader.on(\"error\", error => {\n  console.error(\"Error occurred:\", error);\n});\n```\n\n## License\n\nMIT License\n","readmeFilename":"README.md"}