将缓冲的zip文件内容复制到远程计算机

时间:2018-02-26 05:43:53

标签: node.js

我将浏览的zip文件作为缓冲的十六进制内容。 如何将压缩文件复制到我的远程计算机

1 个答案:

答案 0 :(得分:1)

您可以使用此https://github.com/cthackers/adm-zip

    // creating archives
    var zip = new AdmZip();

    // add file directly
    zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here");
    // add local file
    zip.addLocalFile("/home/me/some_picture.png");
    // get everything as a buffer
    var willSendthis = zip.toBuffer();
    // or write everything to disk
    zip.writeZip(/*target file name*/"/home/me/files.zip");