MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / countFilesWithPrefix

Function countFilesWithPrefix

cache/redis_cache_test.go:274–286  ·  view source on GitHub ↗
(dir, prefix string)

Source from the content-addressed store, hash-verified

272}
273
274func countFilesWithPrefix(dir, prefix string) (int, error) {
275 count := 0
276 files, err := os.ReadDir(dir)
277 if err != nil {
278 return 0, err
279 }
280 for _, file := range files {
281 if strings.HasPrefix(file.Name(), prefix) {
282 count++
283 }
284 }
285 return count, nil
286}

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected