Skip to content

Commit

Permalink
Add jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
alanclarke committed Jan 13, 2020
1 parent b2e0d52 commit 94eb25b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const csv = require('csv-parser')
const fs = require('fs')

/**
* Process large CSV files in batches without backpressure
* @param {string} file - path to the csv file on your file system
* @param {function} fn - async function to apply on each batch
* @param {Object} options - optional options object including 'batchSize' and options from 'csv-parser'
*/
module.exports = async function csvBatchMap (file, fn, options = {}) {
const batchSize = options.batchSize || 5000
const { size } = await fs.promises.stat(file)
Expand Down

0 comments on commit 94eb25b

Please sign in to comment.