From d039b28c83ea7fa8c3e1cce185f30803481ebe0b Mon Sep 17 00:00:00 2001 From: Donnie Date: Thu, 7 Jan 2021 10:13:31 -0600 Subject: [PATCH] Added lmza, added ci file --- .drone.yml | 10 ++++++++++ go.mod | 5 ++++- go.sum | 2 ++ main.go | 15 ++++++++++++++- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..28494d5 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,10 @@ +--- +kind: pipeline +type: docker +name: default + +steps: +- name: digby + image: golang:1.13.8 + commands: + - go build \ No newline at end of file diff --git a/go.mod b/go.mod index 9903b22..331dab3 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module digby go 1.13 -require github.com/DataDog/zstd v1.4.5 // indirect +require ( + github.com/DataDog/zstd v1.4.5 + github.com/itchio/lzma v0.0.0-20190703113020-d3e24e3e3d49 +) diff --git a/go.sum b/go.sum index 64f961f..eddb263 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/itchio/lzma v0.0.0-20190703113020-d3e24e3e3d49 h1:+YrBMf3rkLjkT10zIHyVE4S7ma4hqvfjl6XgnzZwS6o= +github.com/itchio/lzma v0.0.0-20190703113020-d3e24e3e3d49/go.mod h1:avNrevQMli1pYPsz1+HIHMvx95pk6O+6otbWqCZPeZI= diff --git a/main.go b/main.go index 964c362..cba64e3 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,12 @@ /* Digby: A multi-file copmressor + +There are some drawbacks to this application. +1) You can't compress multiple files or a folder at this moment. +2) It puts the files into memory, which is bad if the file you want to compress + is bigger than the memory you have. +3) There's no support for using the `*` modifier for compressing all files in + working directory. */ package main @@ -14,7 +21,8 @@ import ( "os" // Third-party packages - "github.com/DataDog/zstd" + "github.com/DataDog/zstd" // zstd support + "github.com/itchio/lzma" // lzma support ) func main() { @@ -56,6 +64,11 @@ func main() { w := zstd.NewWriterLevel(f, *&lvl) w.Write(data) w.Close() + } else if *&comp == "lzma" { + f, _ = os.Create(*&path + *&file + ".lzma") + w := lzma.NewWriter(f) + w.Write(data) + w.Close() } fmt.Println("Successfully compressed ", *&file, " using ", *&comp)