Documentation ¶
Overview ¶
Package zipserver provides a helper function to serve static assets over HTTP directly from a ZIP file.
Its main advantage over zip.Reader wrapped with http.FS and http.FileServer is ability to directly serve Deflate-compressed contents insize ZIP archives to clients.
Usage example:
func run(filename string) error { zr, err := zip.OpenReader(filename) if err != nil { return err } defer zr.Close() return http.ListenAndServe("localhost:8000", zipserver.Handler(&zr.Reader)) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler wraps *zip.Reader, providing HTTP access to its contents. If an incoming HTTP request announces support for compressed content with “Accept-Encoding: deflate” header, and a requested file inside a ZIP archive is compressed with Deflate method, Handler serves such file to the client as a “Content-Encoding: deflate” response.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.