~mendelmaleh/download

c6053612c2e6746462adb32e00dddf4bb249bd5d — Mendel E 11 months ago 6636a71
Remove separator arg in Interface.URLs()

Instead separate filename from path, and use opt.Separator later on.
2 files changed, 4 insertions(+), 4 deletions(-)

M download.go
M tar.go
M download.go => download.go +2 -2
@@ 7,12 7,12 @@ import (

// A type that satisfies download.Interface can be downloaded with download.Tar etc.
type Interface interface {
	URLs(sep string) []File
	URLs() []File
}

// File to download. URL is where to get the data, path is where to store it.
type File struct {
	Path, URL string
	Path, Name, URL string
}

// DL is the downloader.

M tar.go => tar.go +2 -2
@@ 27,7 27,7 @@ func (dl *DL) Tar(data Interface, file *os.File, opt *Options) error {
	}

	// get files
	files := data.URLs(opt.Separator)
	files := data.URLs()
	if len(files) == 0 {
		return ErrNoData
	}


@@ 76,7 76,7 @@ func (dl *DL) tar(f File, a *tar.Writer, opt *Options) {
	defer dl.Write.Unlock()

	a.WriteHeader(&tar.Header{
		Name: f.Path,
		Name: f.Path + opt.Separator + f.Name,
		Mode: 0600,
		Size: int64(buf.Len()),
	})