public IActionResult GetFile(CancellationToken cancellationToken, string fileName, [FromQuery] string directoryName) { return(new FileCallbackResult( new MediaTypeHeaderValue(GetMimeType(fileName)), async(outputStream, _) => { using (var stream = _dbFileService.GetFileReadStream(fileName, directoryName)) { await stream.CopyToParallelAsync(outputStream, 32000 * 10, cancellationToken); } })); }
private IEnumerable<string> GetLogFileLines(string logFileName, string directoryName) { if (!_dbFileService.FileExistsAsync(logFileName, directoryName, CancellationToken.None).Result) { return Enumerable.Empty<string>(); } var logFileStream = _dbFileService.GetFileReadStream(logFileName, directoryName); var reader = new StreamReader(logFileStream); return ReadAllLines(reader); }