add cookie. add city database

pull/1644/head
Sergei Meza 2022-10-18 16:22:54 +09:00
parent e18ce22784
commit 5a8464e4e0
1 changed files with 1 additions and 7 deletions

View File

@ -20,16 +20,10 @@ if (process.env.MAXMIND_LICENSE_KEY) {
const dest = path.resolve(__dirname, '../node_modules/.geo');
const citiesDest = path.resolve(__dirname, '../node_modules/.cities-geo');
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest);
}
if (!fs.existsSync(citiesDest)) {
fs.mkdirSync(citiesDest);
}
const download = url =>
new Promise(resolve => {
https.get(url, res => {
@ -62,7 +56,7 @@ download(citiesUrl).then(
new Promise((resolve, reject) => {
res.on('entry', entry => {
if (entry.path.endsWith('.mmdb')) {
const filename = path.join(citiesDest, path.basename(entry.path));
const filename = path.join(dest, path.basename(entry.path));
entry.pipe(fs.createWriteStream(filename));
console.log('Saved cities geo database:', filename);