PapaParse is good CSV parser for Javascript, and it will help you to read CSV from local or remote path, but again you need to construct it to your class and you need again one more package like https://www.npmjs.com/package/class-transformer , unless you want to write your own personal implementation for transforming json response to modal class.
Now, the question is how big your CSV is and do you really want to use these above mentioned libraries, if you just want to transform local CSV from HTTPGET to class than alone class-transformer is good enough, but if you want multiple operation on big heavy csv file then use papa parse as well, please refer https://www.papaparse.com/docs#config for all option provided by papa parse.
Please find below my personal implementation of papa parse and csv transformer both the libraries.
import * as jsonParse from 'papaparse';
import { plainToClass } from 'class-transformer';
fetchDataFromCSV() {
return this.httpClient.get(this.csvPath, { responseType: 'text' })
.toPromise()
.then(res => this.getPersons(res));
}
getPersons(res): Person[] {
const csvData = res;
const parsedData = jsonParse.parse(csvData, this.parseConfig).data;
// parseConfig is papa parse option object, refer https://www.papaparse.com/docs#config for all posible parsing options.
this.headerRow = parsedData[0]; // if you want to do something with header row
const allPersons = plainToClass(Person, parsedData as Object[]);
return allPersons;
}