Documentation ¶
Overview ¶
The filesystem package provides an http.FileSystem implementation that may contain file data not present in the host operating system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem struct { // Fallback instructs the filesystem to fall back to the operating system // if a file hasn't beed aded to it. Fallback bool // contains filtered or unexported fields }
A FileSystem is used to store and access file data. It implements the http.FileSystem interface to be used effortlessly with a FileServer handler.
Since all file data can be provided as a string literal in the Go source, such entries can be effectively embedded into the resultant binary.
func (*FileSystem) Add ¶
func (fs *FileSystem) Add( name string, size int64, mode os.FileMode, modTime time.Time, data string, ) error
Add inserts a new named file representation into the filesystem. The size, mode and modTime parameters represent it's byte length, mode bits, and modification time, respectively. The file data is represented as a string, which is usually created using the fmt package's '%q' verb.
If the file name represents a relative path, it will be converted to an absolute path where it's base directory is root of the filesystem. E.g.:
relative/path -> /relative/path ./relative/path -> /relative/path /absolute/path -> /absolute/path