zipstream

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package zipstream provides streaming helpers to create a zip archive and send it as base64 without buffering the entire archive in memory.

Use StreamZipToBase64 for convenience or StreamZipToBase64Writer to stream directly to an io.Writer with optional context for cancellation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SafeJoin

func SafeJoin(baseDir, relPath string) (string, error)

SafeJoin joins baseDir and relPath, ensuring result stays within baseDir.

func StreamZipToBase64

func StreamZipToBase64(entries []Entry, opts *Options) (string, error)

func StreamZipToBase64Writer

func StreamZipToBase64Writer(ctx context.Context, w io.Writer, entries []Entry, opts *Options) (err error)

Types

type Entry

type Entry struct {
	Name string
	Path string
}

type Options

type Options struct {
	CompressionLevel int
	SkipMissing      bool
	Filter           func(e Entry) bool
	NowFunc          func() time.Time
	// BaseDir: if set, resolve Entry.Path relative to this directory using SafeJoin.
	BaseDir string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL