Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
async-require
Advanced tools
asyncronous module loader
Example
//ironically loading async-require using syncronaous require.
var asyncRequire = require('async-require');
Promise.<(module|Error)>
⏏
Promise.<(module|Error)>
⏏Kind: Exported function
Param | Type | Description |
---|---|---|
module | string | the path to the module without a .js extension |
Example
//load script myModule.js
asyncRequire('myModule').then(function(module){
//module has been exported
});
load is used by async-require to load the script. By default it load a file relative to the calling module similar to how require works when loading module not installed through npm. Since this function is public you can set a new load method.
Kind: inner method of requireAsync
Access: public
Example
load a script with request
var asyncRequire = require('async-require'),
request = require('request'),
Promise = require('promise'),
//load must return a promise
get = Promise.promisify(request.get);
//overwrite the default load
asyncRequire.load = function(url){
//get the script
return get(url).spread(function(res, body){
//returrn only the body of the script
return body;
})
}
FAQs
async module loader
The npm package async-require receives a total of 96 weekly downloads. As such, async-require popularity was classified as not popular.
We found that async-require 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.