sendStaticFile function

void sendStaticFile(
  1. HttpRequest request,
  2. File file,
  3. int length, [
  4. NativeFile? opened,
])

Sends file, a file of Route.staticFiles with length bytes (from its stat), like a File that a controller returns. It does not ask the disk for the size again.

Implementation

void sendStaticFile(
  HttpRequest request,
  File file,
  int length, [
  NativeFile? opened,
]) {
  request.response.headers.set(_noSniffHeader, 'nosniff');
  _pipe(request, _sendFile(file, request, length, opened));
}