File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Package ziptree contains code to zip a directory tree and write it out.
12package ziptree
23
34import (
@@ -10,6 +11,7 @@ import (
1011 "time"
1112)
1213
14+ // Option for zipping
1315type Option func (* config )
1416
1517type config struct {
@@ -21,18 +23,21 @@ func newConfig() *config {
2123 return & config {Compress : true }
2224}
2325
26+ // Compress is an Option to compress a zip or not
2427func Compress (f bool ) Option {
2528 return func (c * config ) {
2629 c .Compress = f
2730 }
2831}
2932
33+ // FixMtime is an Option to fix mtimes of the file in the zip
3034func FixMtime (t time.Time ) Option {
3135 return func (c * config ) {
3236 c .Mtime = t
3337 }
3438}
3539
40+ // Zip a directory tree
3641func Zip (srcPath string , opts ... Option ) ([]byte , error ) {
3742 c := newConfig ()
3843 for _ , opt := range opts {
You can’t perform that action at this time.
0 commit comments