I have got a file from url, for example http://localhost/media/gallery/3-test2.jpeg
as an image, but it could be also video file or audio file. How could I get information about what type of file is it?
So far I tried using httpClient
get
method.
media.service.ts
public getMedia(url: string): Observable<File> {
return this.http.get<File>(url).pipe(
catchError(this.api.handleError)
);
}
media.component.ts
this.mediaApi.getMedia(url).subscribe(
response => console.log(response)
);
But I gets only Method OPTIONS is not allowed by Access-Control-Allow-Methods in preflight response
Is that the good way to achieve what I want and if yes what should I change in my code to achieve that?