ASIIC 编码转 Base64… 问了同学原理然后搞定了…
tar 包解压的那一步… 不知道 Node 怎么用, 只好调用了 Bash 命令
代码是 LiveScript
require! \fs
require! \buffer
require! \path
{exec} = require \child_process
show = console.log
fs.read-file \string.txt \utf8 (err, file) ->
throw err if err?
string = file.replace(/\_/g, '1').replace(/\n/g, ' ')
arr = string.split ' '
res = arr
.map -> parse-int it, 2
.map -> String.from-char-code it
.join ''
b = new Buffer res, \base64
fs.write-file \a.tgz b, ->
exec "/bin/tar zxvf a.tgz" (err, stdout, stder) ->
# show arguments
arg = path.join __dirname, \./cang.jpg
exec "google-chrome #arg"