Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Adds several utilities on top of async.js. Aimed to be used as drop-in replacement:
var async = require('asynx');
// or be more explicit
var asynx = require('asynx');
npm install asynx
Hijack callback into returning predefined result(s). Error is propagated unchanged.
asynx.waterfall([
// get response and body of an url
asynx.apply(request.get, url),
// write body to file, but return http response from waterfall
function (response, body, callback) {
fs.writefile(filename, asynx.return(response, callback))
}
], callback)
asynx.waterfall([
// get response and body of an url
asynx.apply(request.get, url),
// throw away response and pass body to fs.writeFile
asynx.shift,
// write body to a file
asynx.apply(fs.writeFile, filename)
], callback)
function cachedGet(url, callback) {
var filename = __dirname + '/cache/' + url.replace(/\//g, '#');
asynx.if(
asynx.apply(fs.exists, filename),
asynx.apply(fs.readFile, filename),
asynx.apply(asynx.waterfall, [
asynx.apply(request, url),
function (response, body, callback) {
fs.writeFile(filename, body, function (error) {
callback(error, body);
});
}
]),
callback
)
}
function cachedGet(url, callback) {
var filename = __dirname + '/cache/' + url.replace(/\//g, '#');
asynx.manual({
// always starts from 'start' state
start: function (next) {
fs.exists(filename, function (exists) {
// go to some new state
if (exists) next.readCache()
else next.request();
});
},
request: function (next) {
// use state transition as callback
request(url, next.writeCache);
},
readCache: function (next) {
// use next.end to leave state machine
fs.readFile(filename, 'utf-8', next.end);
},
writeCache: function (response, body, next) {
fs.writeFile(filename, body, 'utf-8', function (error) {
next.end(error, body);
});
}
}, callback);
}
FAQs
Async utility extensions
The npm package asynx receives a total of 4 weekly downloads. As such, asynx popularity was classified as not popular.
We found that asynx 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.