iptv-m3u
v1.1.5
Published
Read and write m3u files for iptv
Downloads
8
Maintainers
Readme
IpTv M3U
A simple module that allows you to convert M3U playlists to objects, and objects to M3U playlists. It basically can read and write M3U files.
Import
ES Modules (ESM)
import * as m3u from 'iptv-m3u';
CommonJS
const m3u = require('iptv-m3u');
Usage
Read external M3U file (async)
You can convert an external M3U file to an IptvPlaylist object.
await m3u.readExternalM3u('UrlToM3uFile');
Read string M3U playlist
You can convert a M3U string to an IptvPlaylist object.
await m3u.readStringM3u(stringToRead);
Read local M3U file
You can convert an local M3U file to an IptvPlaylist object.
m3u.readLocalM3u('PathToM3uFile');
You can also use path.join.
m3u.readLocalM3u(path.join(__dirname, 'PathToM3uFile'));
Create M3U String
You can convert an IptvPlaylist object to a M3U file to string.
m3u.createM3uString(iptvPlaylist);
Create M3U File
You can convert an IptvPlaylist object to a M3U file.
m3u.createM3uFile(iptvPlaylist, 'PathToM3uFile');
You can also use path.join.
m3u.createM3uFile(iptvPlaylist, path.join(__dirname, 'PathToM3uFile'));