# print-stats

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

Latest version **0.2.0** (published 2022-08-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install print-stats
pnpm add print-stats
yarn add print-stats
bun add print-stats
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2022-08-05 |
| First published | 2022-08-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | GovSpend |
| Maintainers | sp-dev |
| Keywords | stats, row, processing, records, second |

## Links

- npm: https://www.npmjs.com/package/print-stats
- Repository: https://github.com/smartprocure/print-stats
- Homepage: https://github.com/smartprocure/print-stats#readme
- Issues: https://github.com/smartprocure/print-stats/issues
- npm.io page: https://npm.io/package/print-stats

## Dependencies (3)

- [numeral](https://npm.io/package/numeral.md) ^2.0.6
- [pretty-ms](https://npm.io/package/pretty-ms.md) ^8.0.0
- [convert-hrtime](https://npm.io/package/convert-hrtime.md) ^5.0.0

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2022-08-05
- 0.1.0 — 2022-08-04

## 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.

```typescript
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
```

---
_Source: https://npm.io/package/print-stats · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
