Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda