const http = require('http'); const fs = require('fs'); function checkIfPhishing(urlToPrint, path, lang = 'zh') { fs.mkdirSync(path, { recursive: true }); const file = fs.createWriteStream(`${path}/${lang}.json`); const request = http.get(urlToPrint, function (response) { response .on('finish', function () { console.log('done'); // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" })); }) .pipe(file); }); } // zh checkIfPhishing( 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/zh_Hans/', 'src/locales/lang/weblate', 'zh', ); // en checkIfPhishing( 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/en/', 'src/locales/lang/weblate', 'en', ); // // ja // checkIfPhishing( // 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/ja/', // 'src/i18n/weblate', // 'ja' // ) // // ja // checkIfPhishing( // 'http://192.168.0.163:8080/download/4kankan/eletron_laster_local/ko/', // 'src/i18n/weblate', // 'kr' // )