C2FO / vfs

Pluggable, extensible virtual file system for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] preserving file metadata

kmahyyg opened this issue · comments

Is your feature request related to a problem? Please describe.

Copy file from system into a local-file-based vfs, I wanna preserve original file MAC timestamp. (last-Modified, last-Accessed, Created)

Describe the solution you'd like

Compatible with os.Chtimes(), os.Stat() to get same timestamp as original file.

Describe alternatives you've considered

Nothing.

Additional context

It's about forensics and e-discovery purpose...

We currently provide the vfs.File interface

	// LastModified returns the timestamp the file was last modified (as *time.Time).
	LastModified() (*time.Time, error)

The problem with providing more data like last-accessed or created largely stems around the fact that they aren't uniformly provided. Azure Blob Storage has each of those attributes but AWS S3 and Google Cloud storage do not. The attributes returned os package are very OS dependent. Linux does not keep track of created dates for instance. In fact most POSIX-compliant languages do not because POSIX does not require it. The SFTP backend is in the same boat because attributes come largely from the underlying OS of the sftp server. If we provided a Stat() in vfs, the results would be unreliable across implementations.

Thanks for your explanation. Nice work.