
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
duration-estimator
Advanced tools
Agnostic duration estimator for asynchronous tasks. Estimates remaining time using a moving average whose length is configurable.
Using npm:
npm install duration-estimator --save
Using umd bundle from cdn:
<script src="https://unpkg.com/duration-estimator"></script>
<!-- Globally available as DurationEstimator !-->
Using esm bundle from cdn:
<script type="module">
import { DurationEstimator } from 'https://cdn.skypack.dev/duration-estimator'
</script>
import { DurationEstimator } from 'duration-estimator'
function task (onProgess) {
// Asynchronous task yielding progress in range 0-1
}
const estimator = new DurationEstimator()
task(progress => console.log(`${estimator.estimate(progress)}ms remaining`))
The estimator can be reused after calling reset()
:
estimator.reset() // ready to make estimations for a new task
By default, the estimator computes remaining time based on the last 10 samples it got. You can change that by setting the moving average length:
new DurationEstimator(20) // Takes the last 20 samples in account
new DurationEstimator(Infinity) // Takes all samples in account
FAQs
Agnostic duration estimator for asynchronous tasks
We found that duration-estimator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.
Security News
Former RubyGems maintainers have launched The Gem Cooperative, a new community-run project aimed at rebuilding open governance in the Ruby ecosystem.