promise-reporter
Show the progress of multiple promises.
Last updated 3 years ago by linusu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install promise-reporter 
SYNC missed versions from official npm registry.

Promise Reporter

Show the progress of multiple promises.

Installation

npm install --save promise-reporter

Usage

const Reporter = require('promise-reporter')
const reporter = new Reporter()

reporter.pipe(process.stderr)

reporter.add('Query database', new Promise(/* ... */))
reporter.add('Download S3 file', new Promise(/* ... */))
reporter.add('Start EC2 instance', new Promise(/* ... */))

reporter.end()

Example GIF

API

new Reporter()

Creates a new reporter, which is a Readable stream that you can pipe to e.g. process.stderr.

.add(title: string, promise: Promise)

Adds a promise to the reporter.

.end()

Signal that no more promises will be added. When all the current promises have settled, the stream will end.

Returns a Promise that will settle when the stream has ended.

Current Tags

  • 0.1.4                                ...           latest (3 years ago)

5 Versions

  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |