如何使用 Golang 将文件添加到现有的 zip 文件 [英] How add a file to an existing zip file using Golang

查看:67
本文介绍了如何使用 Golang 将文件添加到现有的 zip 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以创建一个 zip 新文件并使用 Go 语言添加文件.

We can create a zip new file and add files using Go Language.

但是,如何使用 GoLang 添加带有现有 zip 文件的新文件?

But, how to add a new file with existing zip file using GoLang?

如果可以使用Create函数,如何获取zip.writer引用?

If we can use Create function, how to get the zip.writer reference?

有点糊涂.

推荐答案

经过进一步分析,我发现无法在现有 zip 文件中添加任何文件.

After more analysis, i found that, it is not possible to add any files with the existing zip file.

但是,我能够按照 这个 URL.

But, I was able to add files with tar file by following the hack given in this URL.

这篇关于如何使用 Golang 将文件添加到现有的 zip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆