使用nodejs 来压缩整个目录
var fstream = require('fstream'),
tar = require('tar'),
zlib = require('zlib');
fstream.Reader({ 'path': 'sub', 'type': 'Directory' }) /* Read the source directory */
.pipe(tar.Pack()) /* Convert the directory to a .tar file */
.pipe(zlib.Gzip()) /* Compress the .tar file */
.pipe(fstream.Writer({ 'path': '../output/compressed_folder.zip' })); /* Give the output file name */