MCPcopy Index your code
hub / github.com/klauspost/compress / WithEncoderPadding

Function WithEncoderPadding

zstd/encoder_options.go:142–157  ·  view source on GitHub ↗

WithEncoderPadding will add padding to all output so the size will be a multiple of n. This can be used to obfuscate the exact output size or make blocks of a certain size. The contents will be a skippable frame, so it will be invisible by the decoder. n must be > 0 and <= 1GB, 1<<30 bytes. The padd

(n int)

Source from the content-addressed store, hash-verified

140// If `EncodeAll` is used with data already in the destination, the total size will be multiple of this.
141// Can be changed with ResetWithOptions.
142func WithEncoderPadding(n int) EOption {
143 return func(o *encoderOptions) error {
144 if n <= 0 {
145 return fmt.Errorf("padding must be at least 1")
146 }
147 // No need to waste our time.
148 if n == 1 {
149 n = 0
150 }
151 if n > 1<<30 {
152 return fmt.Errorf("padding must less than 1GB (1<<30 bytes) ")
153 }
154 o.pad = n
155 return nil
156 }
157}
158
159// EncoderLevel predefines encoder compression levels.
160// Only use the constants made available, since the actual mapping

Callers 5

getConcBlockOptsFunction · 0.85
getEncOptsFunction · 0.85
TestWithEncoderPaddingFunction · 0.85

Calls

no outgoing calls

Tested by 5

getConcBlockOptsFunction · 0.68
getEncOptsFunction · 0.68
TestWithEncoderPaddingFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…