From d63ba478185432c690c17d0cde52425ec8bc349c Mon Sep 17 00:00:00 2001 From: Caleb Gardner Date: Fri, 11 Dec 2020 01:39:08 -0600 Subject: [PATCH] Added Reader.ModTime --- reader.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reader.go b/reader.go index 8c5a28f..17f4006 100644 --- a/reader.go +++ b/reader.go @@ -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()