Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
A utility to convert node callbacks to promise
fromCallback(
resolver: (cb: (error?: any, ...args: any[]) => any) => any,
[Object {multiArgs: boolean=false} options]
) -> Promise
fromNode(
resolver: (cb: (error?: any, ...args: any[]) => any) => any,
[Object {multiArgs: boolean=false} options]
) -> Promise
Returns a promise that is resolved by a node style callback function. This is the most fitting way to do on the fly promisification when libraries don't expose classes for automatic promisification by undefined.
The resolver function is passed a callback that expects to be called back according to error-first node conventions.
Setting multiArgs to true means the resulting promise will always fulfill with an array of the callback's success value(s). This is needed because promises only support a single success value while some callback API's have multiple success value. The default is to ignore all but the first success value of a callback function.
Using manual resolver:
import util from 'util';
import {fromCallback} from 'a-callback';
// "email-templates" doesn't expose prototypes for promisification
const emailTemplates = util.promisify(require('email-templates'));
const templatesDir = path.join(__dirname, 'templates');
const template = await emailTemplates(templatesDir);
const [html, text] = await fromCallback(cb => template('newsletter', cb), {multiArgs: true});
console.log(html, text);
FAQs
An utility to convert node callbacks to promise
The npm package a-callback receives a total of 0 weekly downloads. As such, a-callback popularity was classified as not popular.
We found that a-callback 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.