iptv-database/scripts/db/export.js
Aleksandr Statciuk 722f167fbb Update export.js
2022-02-12 06:29:23 +03:00

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()