JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 225704
  • Score
    100M100P100Q166643F
  • License MIT

Concatenates segments from a m3u8 playlist into a consumable stream.

Package Exports

  • m3u8stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (m3u8stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-m3u8stream

Concatenates segments from a m3u8 playlist into a consumable stream.

Build Status Dependency Status codecov

Usage

const fs = require('fs');
const m3u8stream = require('m3u8stream')

m3u8stream('http://somesite.com/link/to/the/playlist.m3u8')
    .pipe(fs.createWriteStream('videofile.mp4'));

API

m3u8stream(url, [options])

Creates a readable stream of binary media data. options can have the following

  • chunkReadahead - How many chunks to preload ahead. Default is 3.
  • highWaterMark - How much of the download to buffer into the stream. See node's docs for more. Note that the actual amount buffered can be higher since each chunk request maintains its own buffer.
  • requestOptions - Any options you want to pass to miniget, such as headers.
  • refreshInterval - How often to refresh the playlist. If end of segment list is approached before the next interval, then it will refresh sooner.

Stream has an .end() method, that if called, stops requesting segments, and refreshing the playlist.

Limitations

Currently, it does not support encrypted media segments. This is because the sites where this was tested on and intended for, YouTube and Twitch, don't use it.

This 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.

Install

npm install m3u8stream

Tests

Tests are written with mocha

npm test