Added lmza, added ci file
This commit is contained in:
parent
2e302ab4dc
commit
d039b28c83
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: digby
|
||||
image: golang:1.13.8
|
||||
commands:
|
||||
- go build
|
5
go.mod
5
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
|
||||
)
|
||||
|
|
2
go.sum
2
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=
|
||||
|
|
15
main.go
15
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)
|
||||
|
|
Loading…
Reference in New Issue