How to use the p-progress.all function in p-progress

To help you get started, we’ve selected a few p-progress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JonnyBurger / make-space / index.js View on Github external
module.exports = async input => {
	if (typeof input !== 'string') {
		throw new TypeError(`Expected a string, got ${typeof input}`);
	}
	const spinner = ora('Finding ways to free up space... 0%');
	spinner.start();
	const sizes = await pProgress
		.all(
			strategies.map(strategy => {
				return strategy.probe();
			})
		)
		.onProgress(progress => {
			spinner.text = `Finding ways to free up space... ${percentage(progress)}`;
		});
	spinner.stop();
	const probeSorted = sortBy(
		zip(strategies, sizes).map(([strategy, size]) => ({
			strategy,
			size
		})),
		p => 0 - p.size
	);

p-progress

Create a promise that reports progress

MIT
Latest version published 6 months ago

Package Health Score

62 / 100
Full package analysis

Popular p-progress functions