// const http = require('http') // const fs = require('fs') import http from 'http' import fs from '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/fuse-code/zh_Hans/', 'src/lang/weblate', 'zh' ) // en checkIfPhishing( 'http://192.168.0.163:8080/download/4kankan/fuse-code/en/', 'src/lang/weblate', 'en' ) // ja checkIfPhishing( 'http://192.168.0.163:8080/download/4kankan/fuse-code/ja/', 'src/lang/weblate', 'ja' ) // ja checkIfPhishing( 'http://192.168.0.163:8080/download/4kankan/fuse-code/ko/', 'src/lang/weblate', 'kr' )