英文:
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).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论