promise-reporter

0.1.4 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i promise-reporter

Weekly Downloads

1

Version

0.1.4

License

MIT

Last publish

Collaborators

  • linusu