MCPcopy
hub / github.com/gorilla/websocket / compressNoContextTakeover

Function compressNoContextTakeover

compression.go:44–54  ·  view source on GitHub ↗
(w io.WriteCloser, level int)

Source from the content-addressed store, hash-verified

42}
43
44func compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser {
45 p := &flateWriterPools[level-minCompressionLevel]
46 tw := &truncWriter{w: w}
47 fw, _ := p.Get().(*flate.Writer)
48 if fw == nil {
49 fw, _ = flate.NewWriter(tw, level)
50 } else {
51 fw.Reset(tw)
52 }
53 return &flateWriteWrapper{fw: fw, tw: tw, p: p}
54}
55
56// truncWriter is an io.Writer that writes all but the last four bytes of the
57// stream to another io.Writer.

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected