Skip to content

Commit

Permalink
add file import to debug and fix count
Browse files Browse the repository at this point in the history
  • Loading branch information
joehand committed Feb 3, 2017
1 parent e8ff602 commit cf7a55e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ module.exports = function sync (type, opts, dat) {
})

if (debug.enabled && importStatus) {
importStatus.on('file imported', function (file) {
debug(`Imported ${file.path}`)
})
setInterval(function () {
if (!importDone) debug(`Imported ${prettyBytes(importStatus.bytesImported)} of ${prettyBytes(importStatus.countStats.bytes)}`)
}, opts.logspeed)
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/import-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ module.exports = function () {
return function (importer) {
if (!importer || !importer.bytesImported) return ''
var importedBytes = importer.bytesImported
var importedFiles = importer.fileCount - 1 // counted before import finishes so -1 TODO: fix?
var speed = importer.bytesImported * 1000 / (Date.now() - start)
var progress = Math.round(importedBytes * 100 / importer.countStats.bytes)
return bar(progress) + ` ${importer.fileCount} of ${importer.countStats.files} ${importer.countStats.files === 1 ? 'file' : 'files'}` + ' (' + prettyBytes(speed) + '/s' + ')'
return bar(progress) + ` ${importedFiles} of ${importer.countStats.files } ${importer.countStats.files === 1 ? 'file' : 'files'}` + ' (' + prettyBytes(speed) + '/s' + ')'
}
}

0 comments on commit cf7a55e

Please sign in to comment.