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§
- Single
File Tracker - State tracker for single-file mode in tar source operations.
- TarEntry
Meta - Tar entry metadata extracted from a tar header.
Enums§
- TarCopy
Error - 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’sfilepath.Cleanbehavior. - 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.