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

Function NewReaderWithOptions

zip/reader.go:134–144  ·  view source on GitHub ↗

NewReaderWithOptions is like [NewReader] but applies the supplied options.

(r io.ReaderAt, size int64, opts ReaderOptions)

Source from the content-addressed store, hash-verified

132
133// NewReaderWithOptions is like [NewReader] but applies the supplied options.
134func NewReaderWithOptions(r io.ReaderAt, size int64, opts ReaderOptions) (*Reader, error) {
135 if size < 0 {
136 return nil, errors.New("zip: size cannot be negative")
137 }
138 zr := &Reader{nameDecoder: opts.NameDecoder}
139 var err error
140 if err = zr.init(r, size); err != nil && err != ErrInsecurePath {
141 return nil, err
142 }
143 return zr, err
144}
145
146func (r *Reader) init(rdr io.ReaderAt, size int64) error {
147 end, baseOffset, err := readDirectoryEnd(rdr, size)

Callers 2

TestNameDecoderFunction · 0.85
TestNameDecoderErrorFunction · 0.85

Calls 1

initMethod · 0.95

Tested by 2

TestNameDecoderFunction · 0.68
TestNameDecoderErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…