Fixing issue with init.
This commit is contained in:
parent
ffa2c3459a
commit
333d7279ac
|
@ -29,7 +29,8 @@ async function init() {
|
||||||
}
|
}
|
||||||
const promises = []
|
const promises = []
|
||||||
for (let url of FILE_URLS) {
|
for (let url of FILE_URLS) {
|
||||||
promises.push(downloadFile(url, __dirname))
|
const fileName = url.split("/").slice(-1)[0]
|
||||||
|
promises.push(downloadFile(url, `./${fileName}`))
|
||||||
}
|
}
|
||||||
await Promise.all(promises)
|
await Promise.all(promises)
|
||||||
console.log("Files have been downloaded, ready to start.")
|
console.log("Files have been downloaded, ready to start.")
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
const chalk = require("chalk")
|
const chalk = require("chalk")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const axios = require("axios")
|
const axios = require("axios")
|
||||||
|
const path = require("path")
|
||||||
|
|
||||||
exports.downloadFile = async (url, path) => {
|
exports.downloadFile = async (url, filePath) => {
|
||||||
const writer = fs.createWriteStream(path)
|
filePath = path.resolve(filePath)
|
||||||
|
const writer = fs.createWriteStream(filePath)
|
||||||
|
|
||||||
const response = await axios({
|
const response = await axios({
|
||||||
url,
|
url,
|
||||||
|
|
Loading…
Reference in New Issue