()
| 77 | } |
| 78 | |
| 79 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…