
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
promise-with-retry
Advanced tools
Easily retry operations with any retry strategy you want.
Support async functions or functions returned Promise.
npm install promise-with-retry --save
const RetryOp = require('promise-with-retry').default;
function promiseOperation(...args) {
return new Promise((resolve: any, reject: any) => {
// ...
});
}
async function asyncOperation(...args) {
// ...
}
let myOp = RetryOp.buildOperation(promiseOperation);
// or async function:
// let myOp = RetryOp.buildOperation(asyncOperation);
let myRetry = new RetryOp(myAsyncOp(500), (retryOptions) => {
if (retryOptions.returns.error) {
// retry after 5000ms
return 5000;
}
// finish
return;
});
op
is resolved
myRetry.on('op_resolve', (retryOptions, data) => {
});
data
: value op
resolvedop
is rejected
myRetry.on('op_reject', (retryOptions, error) => {
});
error
: error op
rejectedevent before op
is executed
myRetry.on('retry', (retryOptions) => {
});
op
has stop retry
myRetry.on('finish', (retryOptions) => {
});
fn
: async
function or function returned Promise
op
: value returned by RetryOp.buildOperation(fn)retryStrategy
: (retryOptions) => {} return a number (ms) as timeout, the retry will happen exactly after that time in milliseconds. if return is not number, will not retry.retryOptions
:
startTime
: number, mstotalRetryCount
: numberreturns
: return of op
:
op
rejectedop
resolvedtypescript example:
import RetryOp from 'promise-with-retry';
async function asyncOperation(ms: number) {
// ...
}
let myAsyncOp = RetryOp.buildOperation(asyncOperation);
let myRetry = new RetryOp(myAsyncOp(500), (retryOptions) => {
if (retryOptions.totalRetryCount < 3) {
// will retry after 500ms
return 500;
}
// stop retry
return;
});
myRetry.on('finish', (retryOptions) => {
});
npm tet
FAQs
Easily retry operations with any retry strategy you want.
The npm package promise-with-retry receives a total of 0 weekly downloads. As such, promise-with-retry popularity was classified as not popular.
We found that promise-with-retry 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.