{"id":13907746,"url":"https://github.com/fent/node-m3u8stream","last_synced_at":"2025-05-16T09:04:51.208Z","repository":{"id":45086946,"uuid":"88867662","full_name":"fent/node-m3u8stream","owner":"fent","description":"Concatenates segments from a m3u8/dash-mpd playlist into a consumable stream.","archived":false,"fork":false,"pushed_at":"2024-06-03T22:00:54.000Z","size":7603,"stargazers_count":222,"open_issues_count":10,"forks_count":54,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-14T16:19:35.894Z","etag":null,"topics":["m3u8","nodejs","stream"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T13:18:51.000Z","updated_at":"2025-04-08T07:45:09.000Z","dependencies_parsed_at":"2024-06-18T12:32:48.839Z","dependency_job_id":"7f31b85d-88a6-4348-baa0-f6a62e1a23fa","html_url":"https://github.com/fent/node-m3u8stream","commit_stats":{"total_commits":142,"total_committers":12,"mean_commits":"11.833333333333334","dds":"0.27464788732394363","last_synced_commit":"589b08be4dd47b4bc0090cd1b2d2e22c86e69cb6"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fent%2Fnode-m3u8stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fent%2Fnode-m3u8stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fent%2Fnode-m3u8stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fent%2Fnode-m3u8stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fent","download_url":"https://codeload.github.com/fent/node-m3u8stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501557,"owners_count":22081528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["m3u8","nodejs","stream"],"created_at":"2024-08-06T23:02:08.605Z","updated_at":"2025-05-16T09:04:46.191Z","avatar_url":"https://github.com/fent.png","language":"TypeScript","funding_links":[],"categories":["HarmonyOS","TypeScript"],"sub_categories":["Windows Manager"],"readme":"# node-m3u8stream\n\nReads segments from a [m3u8 playlist][1] or [DASH MPD file][2] into a consumable stream.\n\n[1]: https://tools.ietf.org/html/draft-pantos-http-live-streaming-20\n[2]: https://dashif.org/docs/DASH-IF-IOP-v4.2-clean.pdf\n\n![Depfu](https://img.shields.io/depfu/fent/node-m3u8stream)\n[![codecov](https://codecov.io/gh/fent/node-m3u8stream/branch/master/graph/badge.svg)](https://codecov.io/gh/fent/node-m3u8stream)\n\n\n# Usage\n\n```js\nconst fs = require('fs');\nconst m3u8stream = require('m3u8stream')\n\nm3u8stream('http://somesite.com/link/to/the/playlist.m3u8')\n    .pipe(fs.createWriteStream('videofile.mp4'));\n```\n\n\n# API\n\n### m3u8stream(url, [options])\n\nCreates a readable stream of binary media data. `options` can have the following\n\n* `begin` - Where to begin playing the video. Accepts an absolute unix timestamp or date and a relative time in the formats `1:23:45.123` and `1m2s`.\n* `liveBuffer` - How much buffer in milliseconds to have for live streams. Default is `20000`.\n* `chunkReadahead` - How many chunks to preload ahead. Default is `3`.\n* `highWaterMark` - How much of the download to buffer into the stream. See [node's docs](https://nodejs.org/api/stream.html#stream_constructor_new_stream_writable_options) for more. Note that the actual amount buffered can be higher since each chunk request maintains its own buffer.\n* `requestOptions` - Any options you want to pass to [miniget](https://github.com/fent/node-miniget), such as `headers`.\n* `parser` - Either \"m3u8\" or \"dash-mpd\". Defaults to guessing based on the playlist url ending in `.m3u8` or `.mpd`.\n* `id` - For playlist containing multiple media options. If not given, the first representation will be picked.\n\n### Stream#end()\n\nIf called, stops requesting segments, and refreshing the playlist.\n\n#### Event: progress\n* `Object` - Current segment with the following fields,\n  - `number` - num\n  - `number` - size\n  - `number` - duration\n  - `string` - url\n* `number` - Total number of segments.\n* `number` - Bytes downloaded up to this point.\n\nFor static non-live playlists, emitted each time a segment has finished downloading. Since total download size is unknown until all segment endpoints are hit, progress is calculated based on how many segments are available.\n\n#### miniget events\n\nAll [miniget events](https://github.com/fent/node-miniget#event-redirect) are forwarded and can be listened to from the returned stream.\n\n### m3u8stream.parseTimestamp(time)\n\nConverts human friendly time to milliseconds. Supports the format  \n00:00:00.000 for hours, minutes, seconds, and milliseconds respectively.  \nAnd 0ms, 0s, 0m, 0h, and together 1m1s.\n\n* `time` - A string (or number) giving the user-readable input data\n\n### Limitations\n\nCurrently, it does not support [encrypted media segments](https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-4.3.2.4). This is because the sites where this was tested on and intended for, YouTube and Twitch, don't use it.\n\nThis does not parse master playlists, only media playlists. If you want to parse a master playlist to get links to media playlists, you can try the [m3u8 module](https://github.com/tedconf/node-m3u8).\n\n\n# Install\n\n    npm install m3u8stream\n\n\n# Tests\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffent%2Fnode-m3u8stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffent%2Fnode-m3u8stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffent%2Fnode-m3u8stream/lists"}