iptv2m3u
v0.1.0
Published
convert getAllChannel.json to m3u format.
Downloads
5
Readme
iptv2m3u
convert getAllChannel.json to m3u format.
npmjs
an examlple run in Node.JS
npm i iptv2m3u
// node example.mjs
import { readFile, writeFile } from "fs/promises";
import { IPTV2M3U } from "iptv2m3u";
readFile("./test/getAllChannel.json", { encoding: "utf-8" }).then((str) => {
const iptv2m3u = new IPTV2M3U(str, { platform: "hw", sort: true });
iptv2m3u.getM3uStringAsync().then(async (m3uStr) => {
await writeFile(`./output/cmcc-iptv-${iptv2m3u.length} rtp.m3u`, m3uStr, {
encoding: "utf-8",
});
});
iptv2m3u
.getM3uStringAsync({
proxyPrefix: "http://127.0.0.1:4022/udp/",
})
.then(async (m3uStr) => {
await writeFile(
`./output/cmcc-iptv-${iptv2m3u.length} http.m3u`,
m3uStr,
{ encoding: "utf-8" }
);
});
});
run in browser
Maybe it will works in the browser too, but I haven't tested it yet.