Module tarcopy

Module tarcopy 

Source
Expand description

Tar copy utilities for streaming file transfers over channels. Port of Go’s pkg/util/tarcopy/tarcopy.go.

Provides path normalization with directory traversal protection and single-file mode for tar streams.

Structs§

SingleFileTracker
State tracker for single-file mode in tar source operations.
TarEntryMeta
Tar entry metadata extracted from a tar header.

Enums§

TarCopyError
Errors from tar copy operations.

Constants§

FILE_CHUNK_SIZE
File chunk size for tar streaming (matches Go’s wshrpc.FileChunkSize).
SINGLE_FILE
Custom flag to indicate that the source is a single file.

Functions§

clean_path 🔒
Clean a path, resolving . and .. components and normalizing separators. Matches Go’s filepath.Clean behavior.
fix_path
Fix and normalize a path by removing a prefix and checking for directory traversal.
safe_join
Construct a destination path from a base directory and tar entry name. Ensures the resulting path is within the base directory.
validate_tar_name
Validate a tar entry name for directory traversal.