Function serveStaticFile
Returns a request handler that serves a specific file on disk.
@safe void delegate(scope HTTPServerRequest, HTTPServerResponse) serveStaticFile
(
GenericPath!(vibe.core.path.PosixPathFormat) local_path,
HTTPFileServerSettings settings = null
) @safe;
@safe void delegate(scope HTTPServerRequest, HTTPServerResponse) serveStaticFile
(
string local_path,
HTTPFileServerSettings settings = null
) @safe;
See sendFile
for more information.
Parameters
Name | Description |
---|---|
local_path | Path to the file to serve. |
settings | Optional settings object enabling customization of how the file gets served. |
Returns
A request delegate is returned, which is suitable for registering in
a URLRouter
or for passing to listenHTTP
.