Added Geo game.
31
assets/countries.js
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs').promises;
|
||||
const bhttp = require('bhttp');
|
||||
|
||||
async function init() {
|
||||
const countryImgs = await fs.readdir('./assets/countries');
|
||||
const res = await bhttp.get('http://localhost:3000/api/countries');
|
||||
|
||||
const countries = res.body;
|
||||
const countriesByCode = Object.fromEntries(countries.map((country) => [country.alpha2, country]));
|
||||
|
||||
const imgCountries = await Promise.all(countryImgs.filter((file) => file !== 'encoded').map(async (file) => {
|
||||
const code = file.match(/(\w+).png/)[1];
|
||||
const filename = `${Buffer.from(code).toString('base64')}.png`;
|
||||
|
||||
await fs.copyFile(`./assets/countries/${file}`, `./assets/countries/encoded/${filename}`);
|
||||
|
||||
return {
|
||||
file: filename,
|
||||
code,
|
||||
...countriesByCode[code],
|
||||
};
|
||||
}));
|
||||
|
||||
await fs.writeFile('./assets/countries.json', JSON.stringify(imgCountries, null, 4));
|
||||
|
||||
console.log('Done!');
|
||||
}
|
||||
|
||||
init();
|
||||
1218
assets/countries.json
Normal file
BIN
assets/countries/AD.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
assets/countries/AE.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
assets/countries/AF.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
assets/countries/AG.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
assets/countries/AL.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
assets/countries/AM.png
Normal file
|
After Width: | Height: | Size: 187 KiB |
BIN
assets/countries/AO.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
assets/countries/AQ.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
assets/countries/AR.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
assets/countries/AS.png
Normal file
|
After Width: | Height: | Size: 300 KiB |
BIN
assets/countries/AT.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
assets/countries/AU.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
assets/countries/AZ.png
Normal file
|
After Width: | Height: | Size: 133 KiB |
BIN
assets/countries/BA.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
assets/countries/BB.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
assets/countries/BD.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
assets/countries/BE.png
Normal file
|
After Width: | Height: | Size: 181 KiB |
BIN
assets/countries/BF.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
assets/countries/BG.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
assets/countries/BH.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/countries/BI.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
assets/countries/BJ.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
assets/countries/BO.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
assets/countries/BR.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
assets/countries/BS.png
Normal file
|
After Width: | Height: | Size: 364 KiB |
BIN
assets/countries/BT.png
Normal file
|
After Width: | Height: | Size: 160 KiB |
BIN
assets/countries/BW.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
assets/countries/BY.png
Normal file
|
After Width: | Height: | Size: 146 KiB |
BIN
assets/countries/BZ.png
Normal file
|
After Width: | Height: | Size: 262 KiB |
BIN
assets/countries/CA.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
assets/countries/CD.png
Normal file
|
After Width: | Height: | Size: 251 KiB |
BIN
assets/countries/CF.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
assets/countries/CG.png
Normal file
|
After Width: | Height: | Size: 229 KiB |
BIN
assets/countries/CH.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
assets/countries/CI.png
Normal file
|
After Width: | Height: | Size: 230 KiB |
BIN
assets/countries/CL.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
assets/countries/CM.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
assets/countries/CN.png
Normal file
|
After Width: | Height: | Size: 357 KiB |
BIN
assets/countries/CO.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
assets/countries/CR.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
assets/countries/CU.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
assets/countries/CY.png
Normal file
|
After Width: | Height: | Size: 225 KiB |
BIN
assets/countries/CZ.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
assets/countries/DE.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
assets/countries/DJ.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
assets/countries/DK.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
assets/countries/DM.png
Normal file
|
After Width: | Height: | Size: 351 KiB |
BIN
assets/countries/DO.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
assets/countries/DZ.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
assets/countries/EC.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
assets/countries/EE.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
assets/countries/EG.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
assets/countries/EH.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
assets/countries/ER.png
Normal file
|
After Width: | Height: | Size: 128 KiB |
BIN
assets/countries/ES.png
Normal file
|
After Width: | Height: | Size: 177 KiB |
BIN
assets/countries/ET.png
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
assets/countries/FI.png
Normal file
|
After Width: | Height: | Size: 185 KiB |
BIN
assets/countries/FJ.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
assets/countries/FK.png
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
assets/countries/FM.png
Normal file
|
After Width: | Height: | Size: 325 KiB |
BIN
assets/countries/FO.png
Normal file
|
After Width: | Height: | Size: 237 KiB |
BIN
assets/countries/FR.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
assets/countries/GA.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
assets/countries/GB.png
Normal file
|
After Width: | Height: | Size: 179 KiB |
BIN
assets/countries/GD.png
Normal file
|
After Width: | Height: | Size: 368 KiB |
BIN
assets/countries/GE.png
Normal file
|
After Width: | Height: | Size: 183 KiB |
BIN
assets/countries/GF.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
assets/countries/GH.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
assets/countries/GI.png
Normal file
|
After Width: | Height: | Size: 219 KiB |
BIN
assets/countries/GL.png
Normal file
|
After Width: | Height: | Size: 178 KiB |
BIN
assets/countries/GM.png
Normal file
|
After Width: | Height: | Size: 155 KiB |
BIN
assets/countries/GN.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
assets/countries/GQ.png
Normal file
|
After Width: | Height: | Size: 286 KiB |
BIN
assets/countries/GR.png
Normal file
|
After Width: | Height: | Size: 233 KiB |
BIN
assets/countries/GT.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
assets/countries/GW.png
Normal file
|
After Width: | Height: | Size: 226 KiB |
BIN
assets/countries/GY.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
assets/countries/HN.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
assets/countries/HR.png
Normal file
|
After Width: | Height: | Size: 443 KiB |
BIN
assets/countries/HT.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
assets/countries/HU.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
assets/countries/ID.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
assets/countries/IE.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
assets/countries/IL.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
assets/countries/IM.png
Normal file
|
After Width: | Height: | Size: 262 KiB |
BIN
assets/countries/IN.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
assets/countries/IQ.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
BIN
assets/countries/IR.png
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
assets/countries/IS.png
Normal file
|
After Width: | Height: | Size: 134 KiB |
BIN
assets/countries/IT.png
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
assets/countries/JE.png
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
assets/countries/JM.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
assets/countries/JO.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
assets/countries/JP.png
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
assets/countries/KE.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
assets/countries/KG.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
assets/countries/KH.png
Normal file
|
After Width: | Height: | Size: 427 KiB |
BIN
assets/countries/KI.png
Normal file
|
After Width: | Height: | Size: 305 KiB |