vibe.d beta banner
get vibe.d
0.10.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.

@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

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 Sönke Ludwig

License

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