osfs

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package osfs provides an io/fs implementation of the native OS file system. In windows paths are changed from "C:\Windows" to "/C/Windows" to comply with the path specifications of the fslib.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct{}

FS implements a read-only wrapper for the native file system.

func New

func New() *FS

New wraps the native file system.

func (*FS) Open

func (fsys *FS) Open(name string) (item fs.File, err error)

Open opens a file for reading.

func (*FS) OpenSystemPath

func (fsys *FS) OpenSystemPath(syspath string) (item fs.File, err error)

OpenSystemPath opens a normal path (e.g. 'C:\Windows') instead of a fslib path ('/C/Windows').

func (*FS) Stat

func (fsys *FS) Stat(name string) (fs.FileInfo, error)

Stat returns an fs.FileInfo object that describes a file.

type Info

type Info struct {
	// contains filtered or unexported fields
}

Info wraps fs.FileInfo for native OS items.

func (*Info) IsDir

func (i *Info) IsDir() bool

func (*Info) ModTime

func (i *Info) ModTime() time.Time

func (*Info) Mode

func (i *Info) Mode() fs.FileMode

func (*Info) Name

func (i *Info) Name() string

func (*Info) Size

func (i *Info) Size() int64

func (*Info) Sys

func (i *Info) Sys() interface{}

Sys returns a map of item attributes.

type Item

type Item struct {
	os.File
	// contains filtered or unexported fields
}

Item describes files and directories in the native OS file system.

func (*Item) ReadDir

func (i *Item) ReadDir(n int) ([]fs.DirEntry, error)

func (*Item) Stat

func (i *Item) Stat() (fs.FileInfo, error)

Stat return an fs.FileInfo object that describes a file.

type Root

type Root struct{}

Root is a pseudo root directory for windows partitions.

func (*Root) Close

func (*Root) Close() error

Close does not do anything for window pseudo roots.

func (*Root) IsDir

func (*Root) IsDir() bool

IsDir returns true for window pseudo roots.

func (*Root) ModTime

func (*Root) ModTime() time.Time

ModTime returns the zero time (0001-01-01 00:00) for window pseudo roots.

func (*Root) Mode

func (*Root) Mode() fs.FileMode

Mode returns fs.ModeDir for window pseudo roots.

func (*Root) Name

func (*Root) Name() (name string)

Name always returns . for window pseudo roots.

func (*Root) Read

func (r *Root) Read([]byte) (int, error)

func (*Root) ReadDir

func (*Root) ReadDir(int) ([]fs.DirEntry, error)

func (*Root) Size

func (*Root) Size() int64

Size returns 0 for window pseudo roots.

func (*Root) Stat

func (r *Root) Stat() (fs.FileInfo, error)

Stat returns the windows pseudo roots itself as fs.FileMode.

func (*Root) Sys

func (*Root) Sys() interface{}

Sys returns nil for window pseudo roots.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL