VirtualDirectory class

A static server plug-in.

Implementers

Constructors

VirtualDirectory(Angel app, FileSystem fileSystem, {Directory? source, Iterable<String> indexFileNames = const ['index.html'], String publicPath = '/', dynamic callback(File file, RequestContext req, ResponseContext res)?, bool allowDirectoryListing = false, bool useBuffer = false})

Properties

allowDirectoryListing bool
If true (default: false), then if a directory does not contain any of the specific indexFileNames, a default directory listing will be served.
final
app → Angel
final
callback → dynamic Function(File file, RequestContext req, ResponseContext res)?
An optional callback to run before serving files.
final
fileSystem → FileSystem
final
hashCode int
The hash code for this object.
no setterinherited
indexFileNames Iterable<String>
Filenames to be resolved within directories as indices.
final
publicPath String
An optional public path to map requests to.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source → Directory
The directory to serve files from.
no setter
useBuffer bool
If true (default: true), then files will be opened as streams and piped into the request.
final

Methods

handleRequest(RequestContext req, ResponseContext res) Future<bool>
Responds to incoming HTTP requests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushState(String path, {Iterable? accepts}) → RequestHandler
A handler that serves the file at the given path, unless the user has requested that path.
serveDirectory(Directory directory, String relative, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Serves the index file of a directory, if it exists.
serveFile(File file, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Writes the contents of a file to a response.
servePath(String path, RequestContext req, ResponseContext res) Future<bool>
Writes the file at the given virtual path to a response.
serveStat(String absolute, String relative, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Writes the file at the path given by the stat to a response.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited