UNPKG

iptv-checker

Version:

Node.js CLI tool for checking links in IPTV playlists

24 lines (17 loc) 443 B
import fs from 'fs' export class Playlist { constructor(path) { this.path = path fs.writeFileSync(path, '#EXTM3U\r\n') } append(item) { const message = item?.status?.message || null const lines = item.raw.split('\r\n') const extinf = lines[0] if (message) { lines[0] = `${extinf.trim()} (${message})` } const output = `${lines.join('\r\n')}\r\n` fs.appendFileSync(this.path, output) } }