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

142
Visualizações
problem download large blob file (600mb+)

When a file is loaded with a volume of more than 600MB, it turns out to be empty. The backend completely unloads the file. Used by Axios. Used downloadjs lib for download. I used a lot of lib who likes downloadjs and the result was the same. How can I implement uploading a large file using Axios ?

response

{data: 'Id;Email;ClientDwhId;Number;16_int;22_datetime;22… headers: {…}, cancelTokenSource: {…}}
cancelTokenSource:
  cancel: ƒ cancel(message)
  token: CancelToken
  promise: Promise
   [[Prototype]]: Promise
   [[PromiseState]]: "pending"
   [[PromiseResult]]: undefined
  [[Prototype]]: Object
 [[Prototype]]: Object
data: "Id;Email;ClientDwhId;Number;16_int;22_datetime;2
headers:
  content-disposition: "attachment; filename=File.csv; filename*=UTF-8''File.csv"
  content-length: "42277"
  content-type: "text/csv"
[[Prototype]]: Object
[[Prototype]]: Object
import * as contentDisposition from 'content-disposition';
import * as downloadjs from 'downloadjs';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { ApiResponse } from '../api';

const defaultContentType = 'text/plain';
const defaultFilename = 'file.txt';

const downloadFile = (response: ApiResponse<BlobPart>, filename?: string) => {
//create filename
  if (!filename) {
    const parsedContentDisposition =
      response.headers['content-disposition'] &&
      contentDisposition.parse(response.headers['content-disposition']);
    filename =
      parsedContentDisposition && parsedContentDisposition.parameters
        ? parsedContentDisposition.parameters.filename
        : defaultFilename;
  }
//create content type
  const contentType = response.headers['content-type']
    ? response.headers['content-type']
    : defaultContentType;
//function from downloadjs library
  downloadjs(
    new Blob([response.data]), filename, contentType,);
};

export const downloadFileFromStream = (filename?: string) => (
  stream$: Observable<ApiResponse<BlobPart>>,
) => stream$.pipe(tap(response => downloadFile(response, filename))); //run downloadFile function after response
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

We solved the problem on the server side. They began to save the file on the server and send it by reference, without loading the user with a stream.

about 4 years ago · Juan Pablo Isaza Relatório
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