Efficient serving of pre-compressed static files.
Go to file
Laurence Withers 5c05a75fba Further work; tidying up, begin cmdline tool 2019-03-13 21:55:31 +00:00
cmd/htpacker Further work; tidying up, begin cmdline tool 2019-03-13 21:55:31 +00:00
internal/packed Further work-in-progress, basic packing and inspecting 2019-03-05 18:41:02 +00:00
packer Further work; tidying up, begin cmdline tool 2019-03-13 21:55:31 +00:00
.gitignore Basic work-in-progress, can pack basic files now 2019-02-24 12:17:57 +00:00
README.md Handler implementation 2019-03-08 09:16:38 +00:00
go.mod Basic work-in-progress, can pack basic files now 2019-02-24 12:17:57 +00:00
go.sum Basic work-in-progress, can pack basic files now 2019-02-24 12:17:57 +00:00
handler.go Handler implementation 2019-03-08 09:16:38 +00:00

README.md

HTTP resource pack server

A common scenario is that you have a set of static resources that you want to serve up quickly via HTTP (for example: stylesheets, WASM).

This package provides a net/http-compatible http.Handler to do so, with support for:

  • compression
    • gzip
    • brotli, if you have the external compression binary available at pack time
    • does not yet support Transfer-Encoding, only Accept-Encoding/Content-Encoding
  • etags
  • ranges

The workflow is as follows:

  • (optional) build YAML file describing files to serve
  • run htpacker tool to produce a single .htpack file
  • create htpack.Handler pointing at .htpack file

The handler can easily be combined with middleware (http.StripPrefix etc.).