From 574437e76db5ab12e297eb73ec60ea9319d9dc76 Mon Sep 17 00:00:00 2001 From: Mykhailo Gorianskyi Date: Mon, 6 Nov 2023 23:26:19 +0100 Subject: [PATCH] Fixing postinstall --- src/post-install-2.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/post-install-2.js b/src/post-install-2.js index 52a2dcb1..a081776f 100644 --- a/src/post-install-2.js +++ b/src/post-install-2.js @@ -9,11 +9,12 @@ import axios from 'axios' const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); -const fileCidrs = `${__dirname}/../data/asns_cidrs.csv`; +const fileNord = `${__dirname}/../data/ips_nord.csv`; const fileAsnsZip = `${__dirname}/../data/fullASN.json.zip`; const fileAsnsCsv = `${__dirname}/../data/asns.csv`; let index = [] +const opts = { responseType: 'blob' }; console.log('Creating index, this may take a minute...') @@ -21,7 +22,12 @@ console.time('downloaded') await axios.get('https://raw.githubusercontent.com/ipapi-is/ipapi/main/databases/fullASN.json.zip', { responseType: 'arraybuffer' }) .then((res) => writeFileSync(fileAsnsZip, res.data)) -axios.get('https://github.com/ipverse/asn-info/raw/master/as.csv', { responseType: 'blob' }).then((res) => writeFileSync(fileAsnsCsv, res.data)) +const promises = [ + axios.get('https://github.com/ipverse/asn-info/raw/master/as.csv', opts).then((res) => writeFileSync(fileAsnsCsv, res.data)), + axios.get('https://github.com/Umkus/nordvpn-ips/releases/download/ips/ips.csv', opts).then((res) => writeFileSync(fileNord, res.data)), +]; + +await Promise.all(promises) const zip = new AdmZip(fileAsnsZip) zip.extractAllTo(`${__dirname}/../data`, true)