Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
COUCH_DELIMITER: delimiter || ',',
COUCH_DATABASE: dbname,
COUCH_TRANSFORM: require(__dirname+ "/transform.js"),
COUCH_META: theschema,
COUCH_PARALLELISM: 1
};
console.log(filename, opts);
var doimport = null;
if (filename.indexOf("://") === -1) { //uploaded file
doimport = couchimport.importFile(filename, opts , function(err, data) {
callback(err, data);
});
}
else { //file url
doimport = couchimport.importStream(request.get(filename), opts, function(err, data) {
callback(err, data);
});
}
doimport.on("writecomplete", function( d) {
console.log("writecomplete", d);
latestStatus = d;
d.complete = true;
}).on("written", function(d) {
latestStatus = d;
console.log("written", d);
});
};