Golang中的Zip文件系统

huangapple go评论89阅读模式
英文:

Zip FileSystem in Golang

问题

我正在使用Go开发Web服务器,并希望将所有静态文件放在ZIP文件中。
看起来我需要实现http.FileSystem接口来从ZIP文件中读取。

是否有这样的实现?

我根据以下文章创建了一个实现:
https://stackoverflow.com/questions/21595295/golang-serve-static-files-from-memory#21601539
但是这些文章声称它存在缺陷。

我找到了以下参考资料,其中有关于在Go中添加ZipFileSystem的工作(和提交):
https://codereview.appspot.com/4750047

我想知道是否有一个成熟的、好的Zip http.FileSystem实现在Go中可用?

英文:

I am developing web server in Go and I wish to have all static files in ZIP file.
It looks like I have to implement http.FileSystem interface that will read from ZIP.

Is there such implementation?

I have made one based on
https://stackoverflow.com/questions/21595295/golang-serve-static-files-from-memory#21601539
But these article claims it to be buggy

I found following references that there was work (and commits) to add ZipFileSystem to Golang
https://codereview.appspot.com/4750047

I am wondering if there is good marture implementation of Zip http.FileSystem in Go?

答案1

得分: 11

我写了一个zip static的东西,它可以做你描述的事情。如果你对单元测试感兴趣,它还包含了单元测试。

英文:

I wrote a zip static thing that does what you're describing. Also has unit tests in case you're into that sort of thing.

答案2

得分: 0

还有一个zipfs包,它可以从zip文件中提供HTTP服务(类似于Dustin的库),并且还实现了http.FileSystem接口(同时还有单元测试)。

英文:

There is also a zipfs package, which serves HTTP from zip files (like Dustin's library), and it also implements the http.FileSystem interface. (With unit tests also).

huangapple
  • 本文由 发表于 2014年4月2日 08:07:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/22799225.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定