Permalink
Browse files
slightly better write stream feedback
- Loading branch information...
Showing
with
7 additions
and
6 deletions.
-
+1
−3
lib/commands.js
-
+2
−1
lib/parse-cli.js
-
+4
−2
lib/write-stream.js
|
|
@@ -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()
|
|
|
})
|
|
|
|
|
|
@@ -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()
|
|
|
|
|
|
@@ -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