Documentation
¶
Overview ¶
Package zipfs provides tools to serve content directly from a zip file to an HTTP response. It also provides the necessary tooling to perform changes on an existing zip file.
Index ¶
- type HTTPZipFile
- type ZipRW
- func (z *ZipRW) Add(h *zip.FileHeader, r io.Reader) error
- func (z *ZipRW) AddDestFile(name string) (err error)
- func (z *ZipRW) AddSourceFile(name string) (err error)
- func (z *ZipRW) Close() error
- func (z *ZipRW) Copy(name string) error
- func (z *ZipRW) Dest() *zip.Writer
- func (z *ZipRW) GetRawWriter(h *zip.FileHeader) (io.Writer, error)
- func (z *ZipRW) GetWriter(h *zip.FileHeader) (io.Writer, error)
- func (z *ZipRW) Source() *zip.Reader
- func (z *ZipRW) SrcFiles() []*zip.File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPZipFile ¶
type HTTPZipFile string
HTTPZipFile serves a zip file as an HTTP directory (without listing) It properly handles If-Modified-Since header and can serve the compressed content when deflate is in Accept-Encoding and the content is compressed with deflate.
func (HTTPZipFile) ServeHTTP ¶
func (f HTTPZipFile) ServeHTTP(w http.ResponseWriter, r *http.Request, options ...serveOption)
type ZipRW ¶
type ZipRW struct {
// contains filtered or unexported fields
}
ZipRW is a very simple wrapper around zip.Reader and zip.Writer. It can be used as a simple zip file creator or as a tool to copy files from one zip file to another.
func NewZipRW ¶
NewZipRW returns a new ZipRW using a destination writer and a source reader. Both can be null but, obviously, it won't work very well without at least a writer.
func (*ZipRW) Add ¶
Add adds a new file to the zip file. It creates the necessary directories if needed.
func (*ZipRW) AddDestFile ¶
AddDestFile adds a destination file to ZipRW.
func (*ZipRW) AddSourceFile ¶
AddSourceFile adds a source file to ZipRW.
func (*ZipRW) Close ¶
Close closes all writer resources, including the underlying io.Writer and io.Reader when they implement their respective closer interfaces.
func (*ZipRW) Dest ¶
Dest returns the underlying destination zip.Writer.
func (*ZipRW) GetRawWriter ¶
GetRawWriter returns a raw writer for a zipfile entry.
func (*ZipRW) Source ¶
Source returns the underlying source zip.Reader.