Skip to content

Commit

Permalink
Fixing postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
Umkus committed Nov 6, 2023
1 parent 9c7f9f4 commit 574437e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/post-install-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ 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...')

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)
Expand Down

0 comments on commit 574437e

Please sign in to comment.