mirror of
https://github.com/dsoaress/link-free.git
synced 2026-08-16 22:46:04 +01:00
20 lines
376 B
TypeScript
20 lines
376 B
TypeScript
import fs from 'fs'
|
|
|
|
import { fetchData } from '../src/services/fetchData'
|
|
|
|
async function initialdata() {
|
|
const dataDir = './temp'
|
|
const data = await fetchData()
|
|
|
|
if (!fs.existsSync(dataDir)) {
|
|
fs.mkdirSync(dataDir)
|
|
}
|
|
|
|
fs.writeFileSync(`${dataDir}/data.json`, JSON.stringify(data, null, 2))
|
|
}
|
|
|
|
initialdata().catch(e => {
|
|
console.error(e)
|
|
process.exit(1)
|
|
})
|