취미 기록용 블로그
var fs = require(‘fs’); var UglifyJS = require(“uglify-js”); fs.readFile(‘input.txt’, (err, dataBuf)=>{ if(err){ console.log(“에러 : “+err); process.exit(1); } var uglifyJSOptions = { mangle: { toplevel: true, }, nameCache: {} }; var result = UglifyJS.minify(dataBuf.toString(), uglifyJSOptions); var bs64 = Buffer.from(result.code); fs.writeFileSync(‘output.txt’,bs64.toString(‘base64’)); });… “read more”