Skip to content

Commit

Permalink
add List
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Nov 22, 2016
1 parent b13e255 commit d63920e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions unarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,25 @@ func (a *Archive) Extract(path string) {
}
}
}

// List lists the contents of archive
func (a *Archive) List() []string {
var contents []string

for {
err := a.Entry()
if err != nil {
if err == io.EOF {
break
} else {
fmt.Printf("unarr: Error List: %s\n", err.Error())
continue
}
}

name := a.Name()
contents = append(contents, name)
}

return contents
}

0 comments on commit d63920e

Please sign in to comment.