vibe.d beta banner
get vibe.d
0.8.0

Asynchronous I/O that doesn’t get in your way, written in D

Function serveStaticFile

Returns a request handler that serves a specific file on disk.

void delegate(scope HTTPServerRequest, scope HTTPServerResponse) serveStaticFile (
  Path local_path,
  HTTPFileServerSettings settings = null
) @safe @safe;

void delegate(scope HTTPServerRequest, scope HTTPServerResponse) serveStaticFile (
  string local_path,
  HTTPFileServerSettings settings = null
) @safe @safe;

See sendFile for more information.

Parameters

NameDescription
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.

See Also

serveStaticFiles, sendFile

Authors

Sönke Ludwig

Copyright

© 2012-2015 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.