Initializer
init(publicDirectory:defaultFile:directoryAction:advancedETagComparison:cachePolicy:)
Creates a new
FileMiddleware.init(publicDirectory: String, defaultFile: String? = nil, directoryAction: FileMiddleware.DirectoryAction = .none, advancedETagComparison: Bool = false, cachePolicy: FileMiddleware.CachePolicy = .browserDefault)
Parameters
publicDirectoryThe public directory to serve files from.
defaultFileThe name of the default file to look for and serve if a request hits any public directory. Starting with
/implies an absolute path from the public directory root. Ifnil, no default files are served.directoryActionDetermines the action to take when the request doesn’t have a trailing slash but matches a directory.
advancedETagComparisonThe method used when ETags are generated. If true, a byte-by-byte hash is created (and cached), otherwise a simple comparison based on the file’s last modified date and size.