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

Method Create

zip/writer.go:219–225  ·  view source on GitHub ↗

Create adds a file to the zip file using the provided name. It returns a [Writer] to which the file contents should be written. The file contents will be compressed using the [Deflate] method. The name must be a relative path: it must not start with a drive letter (e.g. C:) or leading slash, and onl

(name string)

Source from the content-addressed store, hash-verified

217// The file's contents must be written to the [io.Writer] before the next
218// call to [Writer.Create], [Writer.CreateHeader], or [Writer.Close].
219func (w *Writer) Create(name string) (io.Writer, error) {
220 header := &FileHeader{
221 Name: name,
222 Method: Deflate,
223 }
224 return w.CreateHeader(header)
225}
226
227// detectUTF8 reports whether s is a valid UTF-8 string, and whether the string
228// must be considered UTF-8 encoding (i.e., not compatible with CP-437, ASCII,

Callers 15

Test_seqdec_decoderFunction · 0.95
TestCVE202133196Function · 0.95
TestInsecurePathsFunction · 0.95
ExampleWriterFunction · 0.95
TestWriterFlushFunction · 0.95
TestWriterDirFunction · 0.95
testBlockFunction · 0.80
mainFunction · 0.80
TestHeader_DecodeFunction · 0.80
testEncoderRoundtripFunction · 0.80

Calls 1

CreateHeaderMethod · 0.95

Tested by 15

Test_seqdec_decoderFunction · 0.76
TestCVE202133196Function · 0.76
TestInsecurePathsFunction · 0.76
ExampleWriterFunction · 0.76
TestWriterFlushFunction · 0.76
TestWriterDirFunction · 0.76
testBlockFunction · 0.64
TestHeader_DecodeFunction · 0.64
testEncoderRoundtripFunction · 0.64