mirror of
https://github.com/iptv-org/epg
synced 2025-12-17 10:56:57 -05:00
Update file.js
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
function list(include = [], exclude = []) {
|
function list(pattern, include = [], exclude = []) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
glob('channels/**/*.xml', function (err, files) {
|
glob(pattern, function (err, files) {
|
||||||
if (include.length) {
|
if (include.length) {
|
||||||
include = include.map(filename => `channels/${filename}.xml`)
|
include = include.map(filename => `channels/${filename}.xml`)
|
||||||
files = files.filter(filename => include.includes(filename))
|
files = files.filter(filename => include.includes(filename))
|
||||||
@@ -18,6 +19,11 @@ function list(include = [], exclude = []) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
function read(filename) {
|
||||||
list
|
return fs.readFileSync(filename, { encoding: 'utf8' })
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
list,
|
||||||
|
read
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user