streamFile method
Streams a file to this response.
HEAD responses will not actually write data.
Implementation
Future streamFile(File file) async {
if (!isOpen) {
throw closed();
}
// A 404 rather than a file system error, whose message names the path.
if (!await file.exists()) throw AngelHttpException.notFound();
contentLength = await file.length();
contentType = _fileContentType(file);
if (correspondingRequest!.method != 'HEAD') {
return addStream(file.openRead().cast<List<int>>()).then((_) => close());
}
}