mirror of
https://github.com/iptv-org/api.git
synced 2025-05-13 02:20:07 -04:00
Update update.js
This commit is contained in:
parent
68bbbf1891
commit
4a37b28838
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
const csv = require('csvtojson')
|
const { csv } = require('./core')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
@ -17,7 +17,7 @@ glob(`${DATABASE_DIR}/*.csv`, async function (err, files) {
|
||||||
const inputFilename = path.parse(inputFile).name
|
const inputFilename = path.parse(inputFile).name
|
||||||
const outputFile = `${OUTPUT_DIR}/${inputFilename}.json`
|
const outputFile = `${OUTPUT_DIR}/${inputFilename}.json`
|
||||||
|
|
||||||
const json = await csv().fromFile(inputFile)
|
const json = await csv.load(inputFile)
|
||||||
fs.writeFileSync(path.resolve(outputFile), JSON.stringify(json, null, 2))
|
fs.writeFileSync(path.resolve(outputFile), JSON.stringify(json, null, 2))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue