[英]Nodejs: how to create a zip file with a existing file
有沒有一種簡單的方法來創建 zip 文件並在 nodejs 中添加一個文件?
我發現了大量描述以下內容的示例:
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
我需要做的是
1. create a zip file
2. add an existing file, not a block of text
3. save the file
我曾經在 python 中使用以下代碼執行此操作
with ZipFile('myzipfile.zip', 'w') as zip_write:
zip_write.write('myfile.txt')
節點相當於創建 zip 文件並向其中添加現有文件?
對於 zip 使用node.js
的文件,您可以使用以下庫。 https://npmjs.com/package/adm-zip此外,它還有可以使用@types/adm-zip
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.