Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Download file using nestjs from server / observable

I am using a BFF as a proxy.

I need get a excel (and pdf) file from server and forward to download from front app (that are using reactjs).

The code:

monthlyGet(): Observable<AxiosResponse<any>> {

    const req: Request = RequestContext.currentContext.req;
    const headers = req.headers as AxiosRequestHeaders;
    const api = this.configService.get<string>('REPORTS_API');
    const path = req.path;
    const query = req.url.split('?')[1];
    const url = `${api}${path}${query ? `?${query}` : ''}`;
    delete headers.host;
    return this.httpService
      .get(url, { headers })
      .pipe(
        catchError((e) => {
          throw new HttpException(e.response?.data, e.response?.status || 500);
        }),
      )

      .pipe(map((response) => response.data));
  }

The result is a corrupted file.

I've tried several ways using stream, buffer... unsuccessfully.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!