WithDecoderDicts allows to register one or more dictionaries for the decoder. Each slice in dict must be in the [dictionary format] produced by "zstd --train" from the Zstandard reference implementation. If several dictionaries with the same ID are provided, the last one will be used. Can be chang
(dicts ...[]byte)
| 110 | // |
| 111 | // [dictionary format]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary-format |
| 112 | func WithDecoderDicts(dicts ...[]byte) DOption { |
| 113 | return func(o *decoderOptions) error { |
| 114 | if o.dicts == nil { |
| 115 | o.dicts = make(map[uint32]*dict) |
| 116 | } |
| 117 | for _, b := range dicts { |
| 118 | d, err := loadDict(b) |
| 119 | if err != nil { |
| 120 | return err |
| 121 | } |
| 122 | o.dicts[d.id] = d |
| 123 | } |
| 124 | return nil |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // WithDecoderDictRaw registers a dictionary that may be used by the decoder. |
| 129 | // The slice content can be arbitrary data. |
searching dependent graphs…