aboutsummaryrefslogtreecommitdiffstats
path: root/utils/fs/os.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/fs/os.go')
-rw-r--r--utils/fs/os.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/utils/fs/os.go b/utils/fs/os.go
new file mode 100644
index 0000000..37ad75a
--- /dev/null
+++ b/utils/fs/os.go
@@ -0,0 +1,36 @@
+package fs
+
+import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
+)
+
+// OS is a simple FS implementation for the current host filesystem.
+type OS struct{}
+
+// NewOS returns a new OS.
+func NewOS() FS {
+ return &OS{}
+}
+
+// Stat returns the filesystem info for a path.
+func (o *OS) Stat(path string) (os.FileInfo, error) {
+ return os.Stat(path)
+}
+
+// Open returns a ReadSeekCloser for the specified path.
+func (o *OS) Open(path string) (ReadSeekCloser, error) {
+ return os.Open(path)
+}
+
+// ReadDir returns the filesystem info for all the archives under the
+// specified path.
+func (o *OS) ReadDir(path string) ([]os.FileInfo, error) {
+ return ioutil.ReadDir(path)
+}
+
+// Join joins the specified elements using the filesystem separator.
+func (o *OS) Join(elem ...string) string {
+ return filepath.Join(elem...)
+}