mirror of
https://github.com/iptv-org/database.git
synced 2024-11-09 22:16:38 -05:00
15 lines
464 B
JavaScript
15 lines
464 B
JavaScript
const { csv, file } = require('../core')
|
|
|
|
const DATA_DIR = process.env.DATA_DIR || './data'
|
|
const OUTPUT_DIR = process.env.OUTPUT_DIR || './.gh-pages'
|
|
|
|
async function main() {
|
|
const files = await file.list(`${DATA_DIR}/*.csv`)
|
|
for (const inputFile of files) {
|
|
const inputFilename = file.getFilename(inputFile)
|
|
const json = await csv.load(inputFile)
|
|
await file.create(`${OUTPUT_DIR}/${inputFilename}.json`, JSON.stringify(json))
|
|
}
|
|
}
|
|
|
|
main()
|