diff --git a/.gitignore b/.gitignore index 97289ca..8681a87 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,6 @@ # node modules node_modules/ -# dist -dist/package.json -dist/README.md - # roolup cache .rollup.cache/ diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 0000000..555e06d --- /dev/null +++ b/dist/README.md @@ -0,0 +1,56 @@ +### A tool for download hls/m3u8 to mp4 + +#### no longer depend on @ffmpeg/ffmpeg since version 2.0 + +### online demo + +[online demo](https://code-app.netlify.app/hls2mp4/) + +### install + +```shell +# npm +npm install hls2mp4 + +# yarn +yarn add hls2mp4 +``` + +### usage + +```js +import Hls2Mp4 from "hls2mp4"; + +const hls2mp4 = new Hls2Mp4({ + /** + * max retry times while request data failed, default: 3 + */ + maxRetry?: number; + /** + * the concurrency for download ts segment, default: 10 + */ + tsDownloadConcurrency?: number; + /** + * the type of output file, can be mp4 or ts, default: mp4 + */ + outputType?: 'mp4' | 'ts'; + +}, (type, progress) => { + // type = 0 => load FFmpeg + // type = 1 => parse m3u8 + // type = 2 => downloading ts + // type = 3 => merge ts +}); + +const buffer = await hls2mp4.download('your m3u8 url') +hls2mp4.saveToFile(buffer, 'test.mp4') +``` + +#### as script +```html + + + +``` diff --git a/dist/package.json b/dist/package.json new file mode 100644 index 0000000..139b816 --- /dev/null +++ b/dist/package.json @@ -0,0 +1,42 @@ +{ + "name": "hls2mp4", + "version": "2.0.5", + "description": "a tool for download hls/m3u8 to mp4", + "main": "index.js", + "types": "index.d.ts", + "repository": "https://github.com/icefee/hls2mp4", + "keywords": [ + "ffmpeg", + "hls", + "m3u8" + ], + "author": "icefee@outlook.com", + "license": "MIT", + "dependencies": { + "aes-js": "^3.1.2" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^25.0.0", + "@rollup/plugin-node-resolve": "^15.0.2", + "@rollup/plugin-typescript": "^11.1.0", + "@types/aes-js": "^3.1.1", + "@types/node": "^20.2.5", + "rollup": "^3.21.4", + "tslib": "^2.0.0", + "typescript": "^4.7.4" + }, + "type": "module", + "homepage": "https://github.com/icefee/hls2mp4", + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +}