MCPcopy
hub / github.com/klauspost/compress / ExampleWriter_RegisterCompressor

Function ExampleWriter_RegisterCompressor

zip/example_test.go:79–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79func ExampleWriter_RegisterCompressor() {
80 // Override the default Deflate compressor with a higher compression level.
81
82 // Create a buffer to write our archive to.
83 buf := new(bytes.Buffer)
84
85 // Create a new zip archive.
86 w := zip.NewWriter(buf)
87
88 // Register a custom Deflate compressor.
89 w.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
90 return flate.NewWriter(out, flate.BestCompression)
91 })
92
93 // Proceed to add files to w.
94}

Callers

nothing calls this directly

Calls 3

RegisterCompressorMethod · 0.95
NewWriterFunction · 0.92
NewWriterFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…