Permalink
Browse files

slightly better write stream feedback

  • Loading branch information...
maxogden committed Jun 3, 2014
1 parent 0eb15d9 commit 22091b8d4c59f33b80a6c5e7191fae5f62e3e2bb
Showing with 7 additions and 6 deletions.
  1. +1 −3 lib/commands.js
  2. +2 −1 lib/parse-cli.js
  3. +4 −2 lib/write-stream.js
View
@@ -711,12 +711,10 @@ dat.progressLogStream = function(verb) {
var logStream = through.obj(function(ch, enc, cb) {
++count
var runtime = ~~Math.floor((Date.now() - start) / 1000)
var runtime = ~~(Math.floor((Date.now() - start) / 500) / 2)// every half second
if (runtime > elapsed) {
elapsed = runtime
log(elapsed, count)
} else if (elapsed === 0) {
log(elapsed, count)
}
cb()
})
View
@@ -10,9 +10,10 @@ module.exports = {
function writeInputStream(inputStream, dat, opts) {
var writer = dat.createWriteStream(opts)
inputStream.pipe(writer)
if (!opts.quiet) writer.pipe(dat.progressLogStream('imported'))
if (!opts.quiet) writer.parser.pipe(dat.progressLogStream('parsed'))
writer.on('end', function() {
dat.close()
View
@@ -12,7 +12,7 @@ var debug = require('debug')('write-stream')
var OBJ_STREAM_OPTS = {highWaterMark: 16}
module.exports = function(dat, opts) {
module.exports = function writeStream(dat, opts) {
var schema = dat.schema
var parser = parseStream(opts, schema)
@@ -27,7 +27,9 @@ module.exports = function(dat, opts) {
through.obj(OBJ_STREAM_OPTS, writeBatch)
)
return combiner.apply(combiner, pipeline)
var processor = combiner.apply(combiner, pipeline)
processor.parser = parser
return processor
function mergeColumns(doc, cb) {
schema.merge(schema.normalize([].concat(opts.columns)), cb)

0 comments on commit 22091b8

Please sign in to comment.