mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update file.js
This commit is contained in:
parent
cca36dce3d
commit
c524ea2dd5
1 changed files with 10 additions and 4 deletions
|
@ -1,8 +1,9 @@
|
|||
const glob = require('glob')
|
||||
const fs = require('fs')
|
||||
|
||||
function list(include = [], exclude = []) {
|
||||
function list(pattern, include = [], exclude = []) {
|
||||
return new Promise(resolve => {
|
||||
glob('channels/**/*.xml', function (err, files) {
|
||||
glob(pattern, function (err, files) {
|
||||
if (include.length) {
|
||||
include = include.map(filename => `channels/${filename}.xml`)
|
||||
files = files.filter(filename => include.includes(filename))
|
||||
|
@ -18,6 +19,11 @@ function list(include = [], exclude = []) {
|
|||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
list
|
||||
function read(filename) {
|
||||
return fs.readFileSync(filename, { encoding: 'utf8' })
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
list,
|
||||
read
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue