Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zip FileSystem in Golang

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 Golang serve static files from memory 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?

like image 534
Andrew Avatar asked Apr 02 '14 00:04

Andrew


People also ask

How to ZIP file in Golang?

To compress a File in Golang, we use the gzip command.

How to zip a directory in Golang?

To zip a file or a directory in Go using the standard library, use zip. Writer type from the archive/zip package. Creating a compressed archive using this method involves going through all the files you want to include, generating a local file header for each one, and writing its contents to the resulting ZIP file.

What is a zip package?

ZIP is an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that may have been compressed. The ZIP file format permits a number of compression algorithms, though DEFLATE is the most common.


1 Answers

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.

like image 59
Dustin Avatar answered Oct 28 '22 16:10

Dustin