get_fonts.js 486 B

123456789101112
  1. const fs = require('fs')
  2. const re = /,([^,]+(ttf|ttc|otf))"/g
  3. const cmd = fs.openSync('dl-fonts.sh', 'w')
  4. fs.readFile('./public/code/DBS.js', { encoding: 'utf-8' }, (err, data) => {
  5. if (!err) {
  6. Array.from((new Set(Array.from(data.matchAll(re)).map(match => match[1]))).values()).forEach(link => {
  7. fs.writeSync(cmd, `curl -o "public/rsrc/fonts/${link}" --create-dirs "https://www.photopea.com/rsrc/fonts/${link}"\n`)
  8. })
  9. fs.closeSync(cmd)
  10. }
  11. })