Documentation
¶
Index ¶
- func CollectFilesForShredding(paths []string, recursive bool) ([]string, error)
- func GetPassesForMethod(method ShredMethod, userPasses int) int
- func ShredDir(root string, passes int, progress ShredProgress) error
- func ShredDirWithMethod(root string, passes int, method ShredMethod, progress ShredProgress) error
- func ShredFile(path string, passes int, progress ShredProgress) error
- func ShredFileWithMethod(path string, passes int, method ShredMethod, progress ShredProgress) error
- func ShredMultiple(paths []string, passes int, method ShredMethod, progress MultiFileProgress) error
- func SyncDirectory(srcDir, destDir string, isVerbose bool) error
- type FileShredStatus
- type MultiFileProgress
- type ShredMethod
- type ShredProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectFilesForShredding ¶ added in v1.50.0
CollectFilesForShredding recursively collects all files from paths, handling directories.
func GetPassesForMethod ¶ added in v1.50.0
func GetPassesForMethod(method ShredMethod, userPasses int) int
GetPassesForMethod returns the number of passes for a given method.
func ShredDir ¶ added in v1.50.0
func ShredDir(root string, passes int, progress ShredProgress) error
ShredDir recursively shreds all files in a directory and then removes the directories.
func ShredDirWithMethod ¶ added in v1.50.0
func ShredDirWithMethod(root string, passes int, method ShredMethod, progress ShredProgress) error
ShredDirWithMethod recursively shreds all files in a directory using the specified method.
func ShredFile ¶ added in v1.50.0
func ShredFile(path string, passes int, progress ShredProgress) error
ShredFile securely deletes a file by overwriting it with random data for a specified number of passes.
func ShredFileWithMethod ¶ added in v1.50.0
func ShredFileWithMethod(path string, passes int, method ShredMethod, progress ShredProgress) error
ShredFileWithMethod securely deletes a file using the specified method.
func ShredMultiple ¶ added in v1.50.0
func ShredMultiple(paths []string, passes int, method ShredMethod, progress MultiFileProgress) error
ShredMultiple shreds multiple files concurrently with progress reporting.
func SyncDirectory ¶
SyncDirectory synchronizes the contents of the source directory (srcDir) with the destination directory (destDir). It copies files and recursively syncs subdirectories. If isVerbose is true, it logs the files being copied.
Parameters:
- srcDir: The source directory to sync from.
- destDir: The destination directory to sync to.
- isVerbose: A boolean flag to enable verbose logging.
Returns:
- error: An error if any occurs during the synchronization process., otherwise nil.
Types ¶
type FileShredStatus ¶ added in v1.50.0
type FileShredStatus struct {
Path string
Size int64
CurrentPass int
TotalPasses int
Percent float64
Done bool
Error error
StartTime time.Time
EndTime time.Time
}
FileShredStatus tracks the shredding status of a single file.
type MultiFileProgress ¶ added in v1.50.0
type MultiFileProgress func(statuses []FileShredStatus)
MultiFileProgress is a callback for reporting progress across multiple files.
type ShredMethod ¶ added in v1.50.0
type ShredMethod string
ShredMethod defines the overwrite pattern to use.
const ( // MethodAuto uses platform-optimized default (3-pass random). MethodAuto ShredMethod = "auto" // MethodRandom uses cryptographically random bytes. MethodRandom ShredMethod = "random" // MethodZero writes all zeros. MethodZero ShredMethod = "zero" // MethodDoD uses DoD 5220.22-M 3-pass (random, complement, random). MethodDoD ShredMethod = "dod" // MethodGutmann uses full 35-pass Gutmann method. MethodGutmann ShredMethod = "gutmann" )
type ShredProgress ¶ added in v1.50.0
ShredProgress is a callback function to report progress of a single file shredding operation.