0

This method allows you to download files larger than 10 GB; is there a server side way to check the progress? Or is there a way to determine how many transfers to clients are active?

public IActionResult GetFile(string fileName)
{
    try
    {
        if (System.IO.File.Exists(fileName))
        {
            var stream = new FileStream(fileName, FileMode.Open);
            return new FileStreamResult(stream, "application/octet-stream");
        }
                
        Console.WriteLine(retMessage);

        return NotFound(retMessage);
    }
    catch (Exception ex)
    {
        return StatusCode(StatusCodes.Status500InternalServerError);
    }
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Angelo
  • 101
  • 1
  • 9
  • `FileStreamResult` does not provide a built-in way to check the progress of the file transfer. I'm not sure if there has any third-party plugin can achieve it. – Xinran Shen Mar 31 '23 at 06:18
  • instead of the FileStreamResult object can I use another object that supports the progress and download of large files? – Angelo Mar 31 '23 at 06:41
  • Maybe you can refer to this [issue](https://stackoverflow.com/questions/10189270/tracking-the-position-of-the-line-of-a-streamreader) – Xinran Shen Mar 31 '23 at 07:11

0 Answers0