Delivery
- The user completes the import flow in the importer.
- ExpressCSV validates the rows in the browser and groups them into chunks.
onDatareceives each chunk in your app.- Your app sends that chunk to your backend and calls
next()to move to the next chunk. onComplete({ sessionId })finalizes the staged import, whileonCancel({ sessionId })andonError(error, { sessionId })allow you to handle aborted imports and clean up any partial work you may have started.
Basic Example
Backpressure
Chunks are delivered sequentially. ExpressCSV will not send the next chunk until your onData handler calls next(), which lets your app wait while your backend writes the current chunk. Call next() only after the chunk is durably accepted by your backend.
Errors
If onData throws or returns a rejected promise before calling next(), delivery stops and onError(error, { sessionId }) runs. Use onError to report the failure and clean up any partial work you started for that import session.