mafintosh / mafintosh/csv-parser
[category- help] .on('end', ...) not waiting till process inside .on('data', ...) is completed.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
here is the flow of code for what i am doing
```
const results = [];
fs.createReadStream('MainVerbs.csv')
.pipe(csv())
.on('data', async function (row) {
await promiseReturningFunction(row['v1'])
.on('end', () => {
console.log('done');
})
```
Problem is that, `.on('end', ...)` end is being fired before the time consuming processing on all rows is done.
I tried using async await in the `.on('data', ...)` section but it didn't make any difference
how do i work with this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository file or test; start by reproducing the createReadStream().pipe(csv()) chain and its data and end handlers. Check the parser's documented event behavior and establish how completion of asynchronous row processing should be verified; done means the required row work is complete before completion is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100