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.pipe(file).on('finish', function () { console.log(`lang: ${lang} get translate in ${path} Done!`); // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" })); }); }); } // editor zh checkIfPhishing( 'http://192.168.0.163:8080/download/daikan/backend/zh_Hans/', 'src/locales/lang/webslate', 'zh', ); // editor en checkIfPhishing( 'http://192.168.0.163:8080/download/daikan/backend/en/', 'src/locales/lang/webslate', 'en', );