Help us shape the future of Go! Take the 2026 Go Developer Survey

disk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir added in v1.0.0

type Dir string

Dir is the public path

func (Dir) Open added in v1.0.0

func (dir Dir) Open(name string) (http.File, error)

Open implements FileSystem using os.Open, opening files for reading rooted

type Disk

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

Disk disk

func Open

func Open(root string) (*Disk, error)

Open the application

func (*Disk) Exists

func (disk *Disk) Exists(name string) (bool, error)

Exists check if the file is exists

func (*Disk) FS added in v1.0.0

func (disk *Disk) FS(root string) http.FileSystem

FS returns a http.FileSystem that serves files from the public directory

func (*Disk) Glob added in v1.0.0

func (disk *Disk) Glob(pattern string) ([]string, error)

Glob the files by pattern

func (*Disk) Info added in v1.0.0

func (disk *Disk) Info(name string) (os.FileInfo, error)

Info the file info

func (*Disk) Read

func (disk *Disk) Read(name string) ([]byte, error)

Read the file content

func (*Disk) Remove

func (disk *Disk) Remove(name string) error

Remove the file

func (*Disk) Root added in v1.0.0

func (disk *Disk) Root() string

Root return the root path

func (*Disk) Walk

func (disk *Disk) Walk(root string, handler func(root, file string, isdir bool) error, patterns ...string) error

Walk traverse folders and read file contents

func (*Disk) Watch

func (disk *Disk) Watch(handler func(event string, name string), interrupt chan uint8) error

Watch the file changes

func (*Disk) Write

func (disk *Disk) Write(name string, data []byte) error

Write the file content

Jump to

Keyboard shortcuts

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