Added Reader.ExtractTo for ease of use

This commit is contained in:
Caleb Gardner
2020-12-10 08:52:49 -06:00
parent 1da97137a5
commit c7593eaff3
2 changed files with 10 additions and 5 deletions
+9
View File
@@ -114,6 +114,15 @@ func NewSquashfsReader(r io.ReaderAt) (*Reader, error) {
return &rdr, nil
}
//ExtractTo tries to extract ALL files to the given path. This is the same as getting the root folder and extracting that.
func (r *Reader) ExtractTo(path string) []error {
root, err := r.GetRootFolder()
if err != nil {
return []error{err}
}
return root.ExtractTo(path)
}
//GetRootFolder returns a squashfs.File that references the root directory of the squashfs archive.
func (r *Reader) GetRootFolder() (root *File, err error) {
root = new(File)