{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gzip\n\n## Constants\n\n```go\nconst (\n\t// MinSize is the minimum size of content we will compress\n\tMinSize = 1400\n)\n```\n\n## Functions\n\n```go\nfunc Middleware(options ...Options) macaron.Handler\n```\nMiddleware creates a macaron.Handler to proxy the response\n\n## Types\n\n```go\ntype Options struct {\n\tCompressionLevel int\n}\n```\nOptions represents the configuration for the gzip middleware\n\n```go\ntype ProxyResponseWriter struct {\n\tmacaron.ResponseWriter\n\t// contains filtered or unexported fields\n}\n```\nProxyResponseWriter is a wrapped macaron ResponseWriter that may compress its contents\n\n```go\nfunc (proxy *ProxyResponseWriter) Close() error\n```\nClose the writer\n\n```go\nfunc (proxy *ProxyResponseWriter) Flush()\n```\nFlush the writer\n\n```go\nfunc (proxy *ProxyResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)\n```\nHijack implements http.Hijacker. If the underlying ResponseWriter is a Hijacker, its Hijack method is returned. Otherwise an error is returned.\n\n```go\nfunc (proxy *ProxyResponseWriter) Write(b []byte) (int, error)\n```\nWrite appends data to the proxied gzip writer.\n\n```go\nfunc (proxy *ProxyResponseWriter) WriteHeader(code int)\n```\nWriteHeader will ensure that we have setup the writer before we write the header\n\n```go\ntype WriterPool struct {\n\t// contains filtered or unexported fields\n}\n```\nWriterPool is a gzip writer pool to reduce workload on creation of gzip writers\n\n```go\nfunc NewWriterPool(compressionLevel int) *WriterPool\n```\nNewWriterPool creates a new pool\n\n```go\nfunc (wp *WriterPool) Get(rw macaron.ResponseWriter) *gzip.Writer\n```\nGet a writer from the pool - or create one if not available\n\n```go\nfunc (wp *WriterPool) Put(w *gzip.Writer)\n```\nPut returns a writer to the pool\n\n","path":"github.com/RedAFD/code-core/modules/gzip","name":"gzip","synopsis":"","isRedistributable":true}
