shredder

package module
v0.0.0-...-415234d Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 2 Imported by: 0

README

go-shredder

Installation

go get github.com/Marwanmhks/go-shredder

import (
    "fmt"
    "os"
    "github.com/Marwanmhks/go-shredder"
)

func main() {

	if len(os.Args) != 2 {
        os.Exit(1)
    }
    Input := shredder.Config{Iterations: 3, Remove: true}
    Path := os.Args[1]
    err := Input.File(Path)
    if err != nil {
        fmt.Println("Error: %v", err)
    } else {
        fmt.Println("File shredded")
    }
}
go run yourprogram.go /path/to/your/file

Run tests

Run all tests using go test -v.

To generate coverage report:

  • Run go test -v -coverprofile cover.out > cover.txt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Shred

func Shred(Path string) error

Shred securely overwrites the contents of a file.

Types

type Config

type Config struct {
	Iterations int  // Number of shredding iterations
	Remove     bool // Whether to remove the file after shredding
}

Config represents the configuration for file shredding.

func (Config) File

func (config Config) File(Path string) error

File shreds a file based on the given configuration.

Jump to

Keyboard shortcuts

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