Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
Streaming a file from URL in smaller chunks from a controller back to view for client to download

I am looking to stream a file in chunks from a URL to avoid memory issues(I cannot download the file locally at all and I cannot pass the URL to the client). My main issue that I cannot get passed is returning it to the view for and it starting a download for the user.

js

async downloadAttach(ID: any) {
    
    window.open(await ApiFunc.post('Ticket', 'Download', CommID));// my own API call fucntion that works. 

    
}

This code calls to the API in the C# Controller when a button is clicked. This API works for functions that I currently have in place.

Controller

[Route("api/Ticket/Download")]
        [HttpPost]
        public async Task<//Streamed file> Download([FromBody]string uri)
        {
            //Load file into stream in chunks recursively, to pass back to view
        }

This is the controller that takes the URI supplied from the view section and loads in chunks back to the client.

What is the best practice around this?( I am looking to chunk it out already to avoid memory issues). I have also seen uses of HttpWebRequest but I'm not exactly sure how it works out returning to the view.

HttpWebRequest

Example from: Download/Stream file from URL - asp.net

This is the example I have been looking over that splits it up into small chunks but Im unsure how to get it to return through to the view and download. I have coded it up and made the proper modifications to fit with the packages Im using but onclick nothing happens.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda