serveStat method

Future<bool> serveStat(
  1. String absolute,
  2. String relative,
  3. FileStat stat,
  4. RequestContext req,
  5. ResponseContext res,
)

Writes the file at the path given by the stat to a response.

Implementation

Future<bool> serveStat(String absolute, String relative, FileStat stat,
    RequestContext req, ResponseContext res) async {
  if (stat.type == FileSystemEntityType.directory) {
    return await serveDirectory(
        fileSystem.directory(absolute), relative, stat, req, res);
  } else if (stat.type == FileSystemEntityType.file) {
    return await serveFile(fileSystem.file(absolute), stat, req, res);
  } else if (stat.type == FileSystemEntityType.link) {
    var link = fileSystem.link(absolute);
    return await servePath(await link.resolveSymbolicLinks(), req, res);
  } else {
    return true;
  }
}