1 Star 0 Fork 1

木荣/PUBG-HACKER

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
script-download-data.js 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
木荣 提交于 2018-04-28 17:43 . init
// download data from pubgmap.io
const axios = require('axios')
const fs = require('fs')
const dataMap = {
'erangel-info.json': 'https://api.pubgmap.io/maps/erangel',
'erangel-garages.json': 'https://api.pubgmap.io/maps/erangel/layers/garages',
'erangel-vehicle.json': 'https://api.pubgmap.io/maps/erangel/layers/vehicle_spawns',
'erangel-boat.json': 'https://api.pubgmap.io/maps/erangel/layers/boat_spawns',
'erangel-loot.json': 'https://api.pubgmap.io/maps/erangel/layers/loot_heatmap',
'miramar-info.json': 'https://api.pubgmap.io/maps/miramar',
'miramar-vehicle.json': 'https://api.pubgmap.io/maps/miramar/layers/vehicle_spawns',
'miramar-offroad.json': 'https://api.pubgmap.io/maps/miramar/layers/offroad',
'miramar-boat.json': 'https://api.pubgmap.io/maps/miramar/layers/boat_spawns',
'miramar-loot.json': 'https://api.pubgmap.io/maps/miramar/layers/loot_heatmap',
}
const fileBase = './static/data'
async function main () {
for (const key in dataMap) {
process.stdout.write(`Downloading ${dataMap[key]} to ${fileBase}/${key} `)
let response = null
try {
response = await axios.get(dataMap[key], { responseType: 'arraybuffer' })
fs.writeFileSync(`${fileBase}/${key}`, response.data)
console.log(' - OK!')
} catch (err) {
console.log(' - failed!', err.message)
}
}
}
main().catch(err => {
console.log('unexpected error', err)
cleanup.then(() => {
process.exit(2)
})
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mrxdb/PUBG-HACKER.git
git@gitee.com:mrxdb/PUBG-HACKER.git
mrxdb
PUBG-HACKER
PUBG-HACKER
master

搜索帮助