
Security News
pnpm 11.5 Adds Support for Recognizing npm Staged Publishes
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.
@cookielab.io/progress
Advanced tools
## Overview This package allows you to track progress, running time, operations per second, calculate ETA and consumed memory. It can measure rate of operations in time or percents done and remaining if number of operations to be performed is known.
This package allows you to track progress, running time, operations per second, calculate ETA and consumed memory. It can measure rate of operations in time or percents done and remaining if number of operations to be performed is known.
$ npm install --save @cookielab.io/configuration
or
$ yarn add @cookielab.io/progress
To track progess, .tick() function is used. It takes number of operations performed as parameter. Default value is 1.
You have to specify how do you want to log progress. There are 2 options available:
.tick() change via .enableOnTickLogging() function.enableIntervalLogging() functionimport {ProgressLogger} from '@cookielab.io/progress';
const forceUsers: string[] = ['Darth Vader', 'Luke Skywalker', 'Obi-Wan Kenobi', 'Yoda', 'Qui-Gon Jin', 'Mace Windu'];
const logger = new ProgressLogger(forceUsers.length); // to enable tracking of percents, we have to set total amount performed actions
logger.enableOnTickLogging((message: string): void => console.log(message)); // enable logging of progress when tick changes and set logging function
logger.start(); // starts measuring
forceUsers.forEach((user: string): void => {
// do something
logger.tick(); // mark operation for this element as ended and log status
})
logger.end(); // stops measuring
import {ProgressLogger} from '@cookielab.io/progress';
const forceUsers: string[] = ['Darth Vader', 'Luke Skywalker', 'Obi-Wan Kenobi', 'Yoda', 'Qui-Gon Jin', 'Mace Windu'];
const logger = new ProgressLogger();
logger.enableIntervalLogging(500, (message: string): void => console.log(message)); // enable logging of progress every 500 ms and set logging function
logger.start(); // starts measuring
forceUsers.forEach((user: string): void => {
// do something
logger.tick(number); // save number of operations performed
})
logger.end(); // stops measuring
new ProgressLogger(total?: number)Used to initialize logger. If total is supplied, class measures percents, remaining percents and ETA. If total is not supplied, class measures rate of operations per ms.
.start(): voidUsed to initialize logger measuring. It is already started in the constructor. This can be useful for restarts or to keep the time precise as much as possible when doing more preparations before the process starts.
.stop(): voidUsed to stop logger measuring and logging.
tick(count: number = 1): voidUsed to track progress change. You can specify number of operations performed. If not, 1 is used.
.enableOnTickLogging(logFunction: (message: string) => void): voidUsed to enable logging when .tick() method is called.
Parameter logFunction specifies the function that is called each time a tick method is called.
.enableIntervalLogging(interval: number, logFunction: (message: string) => void): voidUsed to enable logging in specified interval in ms.
Parameter interval specifies the interval in which the logFunction should be called.
Parameter logFunction specifies the function that is called every specified interval.
disableLogging(): voidUsed to disable logging. It stops at the end of measuring by default. This can be used explicitly at any time.
[2.0.0] - 2020-06-17
FAQs
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
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.