Files
athens/cmd/cli/zip.go
2018-02-25 14:34:01 -08:00

22 lines
322 B
Go

package main
import (
"bytes"
"github.com/pierrre/archivefile/zip"
)
type file struct {
Name string
Body string
}
// the dir must end with a "/"
func makeZip(dir string) ([]byte, error) {
buf := new(bytes.Buffer)
if err := zip.Archive(dir, buf, nil); err != nil {
return nil, err
}
return buf.Bytes(), nil
}