Watch
1
0
Fork
You've already forked golang-github-starry-s-zip
0
No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann e78847f21b
Releasing fastforward version 0.2.3-2~ffwd13+u1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-07-08 12:31:19 +02:00
.github/workflows Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
debian Releasing fastforward version 0.2.3-2~ffwd13+u1. 2026-07-08 12:31:19 +02:00
testdata Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
.gitignore Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
.goreleaser.yaml Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
fuzz_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
go.mod Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
go.sum Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
LICENSE Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
reader.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
reader_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
README.md Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
register.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
struct.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
updater.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
updater_example_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
updater_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
writer.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
writer_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00
zip_test.go Adding upstream version 0.2.3. 2026-07-08 12:30:12 +02:00

Go zip library

CI

This project is based on the archive/zip Go standard library. It adds a new Updater that allows appending new files to the existing zip archive without having to decompress the entire-file and allows overwriting of existing files stored in the zip archive.

Usage

import "github.com/STARRY-S/zip"

// Open an existing test.zip archive with read/write only mode for Updater.
f, err := os.OpenFile("test.zip", os.O_RDWR, 0)
handleErr(err)
zu, err := zip.NewUpdater(f)
handleErr(err)
defer zu.Close()

// Updater supports modify the zip comment.
err = zu.SetComment("Test update zip archive")
handleErr(err)

// Append a new file into existing archive.
// Use [zip.APPEND_MODE_OVERWRITE] to overwrite if the file already exists.
// The Append method will create a new io.Writer.
w, err := zu.Append("example.txt", zip.APPEND_MODE_OVERWRITE)
handleErr(err)
// Write data into writer.
_, err = w.Write([]byte("hello world"))
handleErr(err)

For more example usage, please refer to updater_example_test.go.

License

BSD 3-Clause

This zip library is based on the Go standard library.