Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Streaming parser for m3u8 files in node
branch: master
Failed to load latest commit information.
m3u Add date to the list of properties for Item
.gitignore first pass at package.json
LICENSE.txt Removing items from package.
Makefile Move current tests to acceptance Removing items from package.
m3u.js add method for durations of each discontinuity domain
package.json add method for durations of each discontinuity domain
parser.js Make parseLine split only first colon.


node-m3u8 is a streaming m3u8 parser tailored for dealing with Apple's HTTP Live Streaming protocol. It may work for other m3u files, but I have not tested it for those uses.


var m3u8 = require('m3u8');
var fs   = require('fs');

var parser = m3u8.createStream();
var file   = fs.createReadStream('/path/to/file.m3u8');

parser.on('item', function(item) {
  // emits PlaylistItem, MediaItem, StreamItem, and IframeStreamItem
parser.on('m3u', function(m3u) {
  // fully parsed m3u file

All items and the m3u object have toString() methods for conversion to m3u8. Attributes and properties have getter/setters on m3u and item objects:

parser.on('item', function(item) {
  var duration = item.get('bandwidth');
  item.set('uri', '' + item.get('uri'));

The M3U and Item objects are available on m3u8:

var m3u8 = require('m3u8');

var m3u = m3u8.M3U.create();
  duration : 10,
  uri      : 'file'

See tests for more usage patterns.

Something went wrong with that request. Please try again.