JSPM

print-stats

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q64789F
  • License ISC

Print stats when processing rows - records/second, elapsed time, etc.

Package Exports

  • print-stats
  • print-stats/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (print-stats) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Print Stats

Print stats when processing multiple records in a looping scenario. Shows you:

  1. Number of rows.
  2. Number of errors.
  3. Records per second.
  4. Overall elapsed time.
import { stats } from 'print-stats'

const dbStats = stats('myCollection')

const records = await getSomeData()

for (const record of records) {
  try {
    await someDatabase.write(record)
    dbStats.incRows()
  } catch (e) {
    dbStats.incErrors()
  }
  dbStats.print()
}
// myCollection: Rows 6,376 | Errors 1 | Rate 14 rec/sec | Elapsed 7m 15.8s