storage

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExists

func EnsureDirExists(path string) error

EnsureDirExists creates a directory if it doesn't exist.

func SaveStreamToFile

func SaveStreamToFile(stream io.Reader, filePath string, onProgress func(bytesWritten int64)) error

SaveStreamToFile saves an io.Reader stream to a specified file path. It creates necessary directories. It reports progress via the onProgress callback (bytes written).

func SaveStreamToFileWithMetadata added in v0.2.0

func SaveStreamToFileWithMetadata(stream io.Reader, filePath string, modified *string, accessed *string, onProgress func(bytesWritten int64), logger *zap.SugaredLogger) error

SaveStreamToFileWithMetadata saves an io.Reader stream and restores optional timestamps.

Types

type ProgressWriter

type ProgressWriter struct {
	Writer       io.Writer
	BytesWritten int64
	OnProgress   func(bytesWritten int64)
}

ProgressWriter is a wrapper around io.Writer that calls a callback on Write.

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (n int, err error)

Write implements the io.Writer interface.

Jump to

Keyboard shortcuts

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