From 1a2ee9c5d5dca086feaa6216899aee7ffd6d2766 Mon Sep 17 00:00:00 2001 From: Donnie Corbitt Date: Wed, 6 Jan 2021 20:33:35 -0600 Subject: [PATCH] Multiple: - Updated README - Added zstd support - Added go.mod and go.sum --- README.md | 1 + go.mod | 5 +++++ go.sum | 2 ++ main.go | 8 ++++++++ 4 files changed, 16 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/README.md b/README.md index b518c11..a0ac16a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Run the executable and it'll ask you what file you are wanting to compress and w # Supported Compression Systems: - gzip - zlib +- zstd # TODO: - [ ] Have command line arguments diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9903b22 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module digby + +go 1.13 + +require github.com/DataDog/zstd v1.4.5 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..64f961f --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= diff --git a/main.go b/main.go index 9d73de3..acdf40e 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,9 @@ import ( "fmt" "io/ioutil" "os" + + // Third-party packages + "github.com/DataDog/zstd" ) func main() { @@ -42,5 +45,10 @@ func main() { w := zlib.NewWriter(f) w.Write(data) w.Close() + } else if *&comp == "zstd" { + f, _ = os.Create(*&path + *&file + ".zst") + w := zstd.NewWriter(f) + w.Write(data) + w.Close() } } \ No newline at end of file