unable to download the csv file in via rest api

I'm trying to download the CSV content file using the REST API in Codeigniter 4 but it not working, I'm fetching the data from the database which I need to download via rest API. In the controller I found this:

return $this->response->download('test.csv', $data); // $data is string

Front in angular:
const headers = new HttpHeaders().append('responseType', 'blob');
this.http.get(path, { headers }).subscribe(
  (res) => {},
  (error) => {console.error(error)}
);

But not working, am I missing something?

Please guide me.



from Recent Questions - Stack Overflow https://ift.tt/3Bp2zBi
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation