translate.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // const http = require('http')
  2. // const fs = require('fs')
  3. import http from 'http'
  4. import fs from 'fs'
  5. function checkIfPhishing(urlToPrint, path, lang = 'zh') {
  6. fs.mkdirSync(path, { recursive: true })
  7. const file = fs.createWriteStream(`${path}/${lang}.json`)
  8. const request = http.get(urlToPrint, function (response) {
  9. response
  10. .on('finish', function () {
  11. console.log('done')
  12. // console.log(fs.readFileSync(`${lang}.json`, { encoding: "utf8" }));
  13. })
  14. .pipe(file)
  15. })
  16. }
  17. // zh
  18. checkIfPhishing(
  19. 'http://192.168.0.163:8080/download/4kankan/fuse-code/zh_Hans/',
  20. 'src/lang/weblate',
  21. 'zh'
  22. )
  23. // en
  24. checkIfPhishing(
  25. 'http://192.168.0.163:8080/download/4kankan/fuse-code/en/',
  26. 'src/lang/weblate',
  27. 'en'
  28. )
  29. // ja
  30. checkIfPhishing(
  31. 'http://192.168.0.163:8080/download/4kankan/fuse-code/ja/',
  32. 'src/lang/weblate',
  33. 'ja'
  34. )
  35. // ja
  36. checkIfPhishing(
  37. 'http://192.168.0.163:8080/download/4kankan/fuse-code/ko/',
  38. 'src/lang/weblate',
  39. 'kr'
  40. )