Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1854

How can I test that this public PDF exists in Angular?

$
0
0

In Angular 18, I want to return true or false whether a public PDF exist or not. For example, it should return true for :https://sigesbre.brgm.fr/files/fiches/MDO_AgenceEau/MDO_AgenceEau_FRGG015.pdf

My code is the following, but I land in catchError instead of map :

existFile(path: string): Observable<boolean> {    return this.httpClient.get(path, { responseType: 'blob' }).pipe(      map(() => {        console.log('exists', path);        return true;      }),      catchError((e) => {        console.log('does not exist', e);        return of(false);      })    );  }

The error logged in console is :error


Viewing all articles
Browse latest Browse all 1854

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>