-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Rather than having only mtree.NewTarStreamer() with returning an io.Reader.
This currently requires either a goroutine, or a struct that keeps track of position and a buffered reader. (I opted for the goroutine)
Potentially we could have an internal model of collecting the mtree entries from tar headers. Something like:
fh, _ := os.Open("file.tar")
//...
dh := mtree.DirectoryHierarchy{}
entryRdr := mtree.TarEntryReader(fh)
for {
e, err := entryRdr.Next()
if err != nil {
break
}
dh.Entries = append(dh.Entries, e)
}Then the current signature could just wrap this in a goroutine:
func NewTarStreamer(r io.Reader, keywords []string) StreamerAnd then we could more easily expose a non-goroutine, but more blocking, signature like:
func NewDhFromTar(r io.Reader, keywords []string) (*DirectoryHierarchy, error)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels