mirror of
https://github.com/luxfi/filesystem.git
synced 2026-10-30 16:55:58 +00:00
31 lines
658 B
Go
31 lines
658 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package filesystem
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
)
|
|
|
|
var _ Reader = reader{}
|
|
|
|
// Reader is an interface for reading the filesystem.
|
|
type Reader interface {
|
|
// ReadDir reads a given directory.
|
|
// Returns the files in the directory.
|
|
ReadDir(string) ([]fs.DirEntry, error)
|
|
}
|
|
|
|
type reader struct{}
|
|
|
|
// NewReader returns an instance of Reader
|
|
func NewReader() Reader {
|
|
return reader{}
|
|
}
|
|
|
|
// This is just a wrapper around os.ReadDir to make testing easier.
|
|
func (reader) ReadDir(dirname string) ([]fs.DirEntry, error) {
|
|
return os.ReadDir(dirname)
|
|
}
|