GO tooling and library for embedding zip files inside existing binaries.

spsobole 01a8940c89 Sort info 1 سال پیش
cmd 01a8940c89 Sort info 1 سال پیش
example 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
.gitignore 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
README.md c45a91e6ac Fix some formatting 3 سال پیش
build.yaml 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
bundle.go 5a1b0ff2b3 Add ability to see timestamp and size of bundled files 1 سال پیش
go.mod 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
go.sum 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
http_dir.go 781eadc3f6 Cleanup the FS implementationfor vessel 3 سال پیش
http_file.go 7528df9b03 Fix lack of modtime in vessel zip files 1 سال پیش
http_fs.go 7528df9b03 Fix lack of modtime in vessel zip files 1 سال پیش
log.go 7842c7d5b8 A bit of cleanup 3 سال پیش
overlay.go 7528df9b03 Fix lack of modtime in vessel zip files 1 سال پیش
vessel.go 86da497ddd Add a fully flushed out server 3 سال پیش
vessel_test.go 7528df9b03 Fix lack of modtime in vessel zip files 1 سال پیش

README.md

vessel

Implements a golang library and command line tool for embedding contents of a zip file into a golang binary for the purpose of packing the binary and content into a single file for distribution.

The zip file is appended to the back of the binary, and the provided API allows us to access the zipped files directly.

bundling

In the example below, vesselcmd will zip up the content of site/ and attach it to the golang binary server

./vesselcmd build --overwrite --bundle=./server.exe --src=site/

Accessing the bundled resources

Once bundled the golang program can acess the content via:

    b, err := vessel.Self()
    if err != nil {
        panic(err)
    }
    fs := b.FileSystem() // this returns an http.FileSystem 

We can then directly use the returned filesystem to serve http pages/content

    http.Handle("/", http.FileServer(fs))

Or we can access the files ourselves by using the http.FileSystem interfaces

    f, err := fs.Open("/templates/list.html")
    if err != nil {
        return err
    }
    defer f.Close()
    data, err := ioutil.ReadAll(f)