importHls2Mp4from"hls2mp4";consthls2mp4=newHls2Mp4({/** * 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 => parse m3u8// type = 1 => downloading ts// type = 2 => merge ts});constbuffer=awaithls2mp4.download('your m3u8 url')hls2mp4.saveToFile(buffer,'test.mp4')