Documentation
¶
Index ¶
- func CheckFreeSpace(dirPath string) (uint64, error)
- func EnsureDirExists(path string) error
- func ResolveDuplicateFilename(dir, baseName string) string
- func SaveStreamToFile(stream io.Reader, filePath string, onProgress func(bytesWritten int64)) error
- func SaveStreamToFileWithMetadata(stream io.Reader, filePath string, fileSize int64, modified *string, ...) error
- type ProgressWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFreeSpace ¶ added in v0.5.0
CheckFreeSpace returns the available bytes on the volume containing the specified path.
func EnsureDirExists ¶
EnsureDirExists creates a directory if it doesn't exist.
func ResolveDuplicateFilename ¶ added in v0.4.0
ResolveDuplicateFilename finds an available filename by appending numbers if the file exists.
func SaveStreamToFile ¶
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, fileSize int64, modified *string, accessed *string, expectedSha256 *string, onProgress func(bytesWritten int64), logger *zap.SugaredLogger) error
SaveStreamToFileWithMetadata saves an io.Reader stream and restores optional timestamps. If expectedSha256 is provided, the stream is verified against it after the copy succeeds. fileSize is used to select an optimal copy buffer size.
Types ¶
Click to show internal directories.
Click to hide internal directories.