Open mark-hahn opened 4 years ago
this worked for me:
const papaPromise = (importFile) => new Promise((resolve, reject) => {
const file = fs.createReadStream(importFile);
Papa.parse(file, {
header: true,
complete: function(results) {
resolve(results);
},
error: function(error) {
reject(error);
}
});
})
const results = await papaPromise(importFile);
@kcrawfordus thanks for your snipet. It will be great if you can provide a PR to include it as part of papaParse docs
Any plans to have the API itself support promises?
@custompro12 not from my side but I will be happy to review a PR that ads support for it
Was confusing seeing an undefined return type lol, almost had the callback pattern purged from my mind.
Any update on this?
Is there any way to use a promise instead of a callback? I've gotten to where I hate callbacks.