$ go get github.com/cjtoolkit/zipfspackage main
import (
"fmt""log""net/http""github.com/cjtoolkit/zipfs"
)
funcmain() {
// Init ZipFS, if the zip file does not exist it will fallback to embedded zip file within application, if that// also does not exist, it will panic.fs:=zipfs.InitZipFs("asset.zip")
fmt.Println("Running ZipFS via http server on port 8080.")
log.Print(http.ListenAndServe(":8080", http.FileServer(fs)))
}To embed zip to the application, first create a zip file with your preferred achiever with compression disabled. Than append the content of the zip file to the compiled application. You can use this simple shell command to append.
$ cat asset.zip >> applicationThis project is based on the work of the following:
- Rémy Oudompheng
- Mechiel Lukkien
- Derek Parker