Got an not understandable problem with NodeJs pipe(), process is not ending and I had to ctrl+c for quit it, is it an asynchronous matter ?
const fs = require('fs')
const parse = require('csv-parse')
const customers = require('../db/collections').customers
const inputFile = 'mytable.csv'
const input = fs.createReadStream(inputFile)
const parser = parse({ columns: true }, (err, data) => {
if (err) console.log(err)
data.forEach(customer => {
customers.create(customer)
})
})
input.pipe(parser)
via Constantin Guidon
No comments:
Post a Comment