| 1 |
// Copyright (c) 2014-2019 Ludovic Fauvet |
| 2 |
// Licensed under the MIT license |
| 3 |
|
| 4 |
package filesystem |
| 5 |
|
| 6 |
import ( |
| 7 |
"time" |
| 8 |
) |
| 9 |
|
| 10 |
// FileInfo is a struct embedding details about a file served by |
| 11 |
// the redirector. |
| 12 |
type FileInfo struct { |
| 13 |
Path string `redis:"-"` |
| 14 |
Size int64 `redis:"size" json:",omitempty"` |
| 15 |
ModTime time.Time `redis:"modTime" json:",omitempty"` |
| 16 |
Sha1 string `redis:"sha1" json:",omitempty"` |
| 17 |
Sha256 string `redis:"sha256" json:",omitempty"` |
| 18 |
Md5 string `redis:"md5" json:",omitempty"` |
| 19 |
} |
| 20 |
|
| 21 |
// NewFileInfo returns a new FileInfo object |
| 22 |
func NewFileInfo(path string) FileInfo { |
| 23 |
return FileInfo{ |
| 24 |
Path: path, |
| 25 |
} |
| 26 |
} |