
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
timeoutable-wrapper
Advanced tools
A wrapper for a potentially long-running task to signal it's timed out. Does not halt the wrapped task, only signals it's timed out (it's your business how to react on the timeout) by throwing TimeoutError. Supports both promises and node-style callbacks.
npm i --save timeoutable-wrapper
const timeoutable = require('timeoutable-wrapper')
const potentiallyLongRunningTask = async function (arg1, arg2) {
/* some long-running code */
return result
}
// or, with callback
const anotherPotentiallyLongRunningTask = function (arg1, arg2, cb) {
/* some long-running code */
cb(null, result)
}
const timeoutableTask = timeoutable(potentiallyLongRunningTask, 5000)
const anotherTimeoutableTask = timeoutable(anotherPotentiallyLongRunningTask, 5000)
try {
// if task is not completed within 5000 msecs - throw TimeoutError
const result = await timeoutableTask(arg1, arg2)
// if another task is not called callback within 5000 msecs - throw TimeoutError
const result2 = await anotherTimeoutableTask(arg1, arg2)
} catch (err) {
if (err.name === 'TimeoutError') { // or err instanceof timeoutable.TimeoutError
// it's timeout
} else {
// it's something else
}
}
timeoutable (fn, ms) -> FunctionWraps passed function and returns another one, which throws TimeoutError when specified ms expired before fn returned result.
timeoutable.using(PromiseLib) -> timeoutableReturns an instance of timeoutable-wrapper that uses specified PromiseLib to construct and return promises from the lib.
timeoutable.TimeoutErrorType for errors thrown on expired timeouts.
FAQs
Signals timeout of the wrapped function by throwing TimeoutError
We found that timeoutable-wrapper 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.