FS represents settings for request handler serving static files from the local filesystem.

It is prohibited copying FS values. Create new values instead.

FS is referenced in 4 repositories



type FS struct {
	noCopy noCopy

	// Path to the root directory to serve files from.
	Root string

	// List of index file names to try opening during directory access.
	// For example:
	//     * index.html
	//     * index.htm
	//     * my-super-index.xml
	// By default the list is empty.
	IndexNames []string

	// Index pages for directories without files matching IndexNames
	// are automatically generated if set.
	// Directory index generation may be quite slow for directories
	// with many files (more than 1K), so it is discouraged enabling
	// index pages' generation for such directories.
	// By default index pages aren't generated.
	GenerateIndexPages bool

	// Transparently compresses responses if set to true.
	// The server tries minimizing CPU usage by caching compressed files.
	// It adds CompressedFileSuffix suffix to the original file name and
	// tries saving the resulting compressed file under the new file name.
	// So it is advisable to give the server write access to Root
	// and to all inner folders in order to minimze CPU usage when serving
	// compressed responses.
	// Transparent compression is disabled by default.
	Compress bool

	// Enables byte range requests if set to true.
	// Byte range requests are disabled by default.
	AcceptByteRange bool

	// Path rewriting function.
	// By default request path is not modified.
	PathRewrite PathRewriteFunc

	// Expiration duration for inactive file handlers.
	// FSHandlerCacheDuration is used by default.
	CacheDuration time.Duration

	// Suffix to add to the name of cached compressed file.
	// This value has sense only if Compress is set.
	// FSCompressedFileSuffix is used by default.
	CompressedFileSuffix string

	once sync.Once
	h    RequestHandler