MCPcopy
hub / github.com/daptin/daptin / GetFileStat

Function GetFileStat

server/cache/file_cache.go:249–263  ·  view source on GitHub ↗

GetFileStat gets file info for validation

(path string)

Source from the content-addressed store, hash-verified

247
248// GetFileStat gets file info for validation
249func GetFileStat(path string) (FileStat, error) {
250 info, err := os.Stat(path)
251 if err != nil {
252 if os.IsNotExist(err) {
253 return FileStat{Exists: false}, nil
254 }
255 return FileStat{}, err
256 }
257
258 return FileStat{
259 ModTime: info.ModTime(),
260 Size: info.Size(),
261 Exists: true,
262 }, nil
263}
264
265// NewFileCache creates a new file cache using Olric
266func NewFileCache(olricClient *olric.EmbeddedClient, namespace string) (*FileCache, error) {

Callers 1

AssetRouteHandlerFunction · 0.92

Calls 3

StatMethod · 0.80
ModTimeMethod · 0.80
SizeMethod · 0.80

Tested by

no test coverage detected