Added Reader.ModTime

This commit is contained in:
Caleb Gardner
2020-12-11 01:39:08 -06:00
parent 495d2345a4
commit d63ba47818
+6
View File
@@ -5,6 +5,7 @@ import (
"errors"
"io"
"math"
"time"
"github.com/CalebQ42/squashfs/internal/compression"
"github.com/CalebQ42/squashfs/internal/inode"
@@ -148,6 +149,11 @@ func NewSquashfsReader(r io.ReaderAt) (*Reader, error) {
return &rdr, nil
}
//ModTime is the last time the file was modified/created.
func (r *Reader) ModTime() time.Time {
return time.Unix(int64(r.super.CreationTime), 0)
}
//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()