GitShow/sindresorhus/p-progress
sindresorhus

p-progress

Create a promise that reports progress

by sindresorhus
Star on GitHubForknpm

TypeScript

765 stars26 forks9 contributorsQuiet · 2y agoSince 2017v1.0.0MIT

Meet the team

See all 9 on GitHub →
sindresorhus
sindresorhus20 contributions
Richienb
Richienb5 contributions
BendingBender
BendingBender2 contributions
TehShrike
TehShrike1 contribution
zikaari
zikaari1 contribution
papb
papb1 contribution
irrelevelephant
irrelevelephant1 contribution
thollingshead
thollingshead1 contribution

Languages

View on GitHub →
TypeScript52.2%
JavaScript47.8%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
71
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
darsain
Better progress API by reporting both done and total valuesClosedIssue

Current implementation of forcing us to report the progress fraction has a lot of limitations: 1. Hides the done and total values data from callbacks. This data might be useful in various implementations. 1. Takes away the ability to handle progress of jobs that don't know about the total value. Some operations just don't know the , but could still report the progress of how much data has been processed thus far. 1. Inaccurate progress reporting in . Without p-progress, or callback consumers knowing the totals, each job is equal no matter how much data it is processing. I propose not enforcing the passing of fraction, but instead keeping track of both and values, reporting them, and letting the user decide how to handle it. This will give us more options and data in our progress implementations. API: The onProgress callback would than report these values in 1st and 2nd argument. If is , the end is unknown and user can switch handling: In callback, the and values in onProgress callback will be the total additions of both of the values of all passes progress promisses. And if any of the promisses is missing the value, the resulting onProgress callback will also receive as , since we can no longer tell what the total of all promisses is now. Huge benefit of knowing about the total in callback is a more accurate calculation of the whole progress. For example, if you have 2 jobs, one is processing 1KB, another is processing 99KB, and the 1st ends while the 2nd hasn't even started, you now have an accurate progress of , instead of . And if you do want it to report that , well you just do this in each job progress report: And now each job is equal no matter of the amount of data it's processing. As you see, this kind of API would give us a lot more power, options, data, and ability to handle jobs with unknown totals in our implementations, while still remaining very simple.

darsain · 4mo ago
firrae
Using `PProgress.fn` `progress()` always returns 1ClosedIssue

Example code: No matter what I've tried it always returns a single time and then doesn't report anything again. Am I missing something? Node: v14.15.1 Environment: Ubuntu in WSL2 on Windows 10 (application is run in Ubuntu though)

firrae · 4y ago
Richienb
Add `.allSettled()` methodMergedPR

Breaking change: now always returns a promise. Fixes: #10

Richienb · 4y ago
Structured data for AI agents

Repository: sindresorhus/p-progress. Description: Create a promise that reports progress Stars: 765, Forks: 26. Primary language: TypeScript. Languages: TypeScript (52.2%), JavaScript (47.8%). License: MIT. Latest release: v1.0.0 (2y ago). Open PRs: 0, open issues: 0. Last activity: 2y ago. Community health: 71%. Top contributors: sindresorhus, Richienb, BendingBender, TehShrike, zikaari, papb, irrelevelephant, thollingshead.

·@ofershap

Replace github.com with gitshow.dev