mirror of
https://github.com/gomods/athens
synced 2026-02-03 13:20:30 +00:00
22 lines
322 B
Go
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
|
|
}
|