
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
nue is an async control-flow library suited for the node event loop.
$ npm install nue
var nue = require('nue');
var flow = nue.flow;
var fs = require('fs');
var myFlow = flow(
function (file) {
fs.readFile(file, 'utf-8', this.async());
},
function (data) {
if (this.err) throw this.err;
console.log(data);
}
);
myFlow('file1');
Return a function which represents the control-flow.
Arguments
tasks
: Optional. Tasks which are executed in series.Context
this
context of the each task has following properties.
next
: Function. A function to execute a next task.async
: Function. A function to accept parameters for a next task and return a callback, which executes a next task.end
: Function. A function to execute a last task to end a control-flow. The first parameter is an error object.In addition to the above ones, the context of the last task has a following property.
err
: Object. An object represents an error which passed from the end
function.Example
var nue = require('nue');
var flow = nue.flow;
var fs = require('fs');
var myFlow = flow(
function () {
var results = [];
fs.readFile('file1', this.async(results));
},
function (results, data) {
results.push(data.length);
fs.readFile('file2', this.async(results));
},
function (results, data) {
results.push(data.length);
this.next(results);
},
function (results) {
if (this.err) throw this.err;
console.log(results);
this.next();
}
);
myFlow();
### map(Function worker(arg)) -> Function
Return a function to process each value in series.
Arguments
worker
: Required. Function. A function to process each value.arg
: Optional. Object. Each value passed from a previous task.Context
this
context of the worker
has following properties.
next
: Function. A function to process next value.async
: Function. A function to accept parameters for a next task and return a callback, which process next value.end
: Function. A function to execute a last task to end a control-flow. The first parameter is an error object.isFirst
: Boolean. Indicate whether the worker is handling the first value or not.isLast
: Boolean. Indicate whether the worker is handling the last value or not.index
: Number. An index of value.Example
var nue = require('nue');
var flow = nue.flow;
var map = nue.map;
var fs = require('fs');
var myFlow = flow(
function () {
this.next('file1', 'file2', 'file3');
},
map(function (name) {
var self = this;
fs.readFile(name, function (err, data) {
if (err) throw this.end(err);
self.next(data.length);
});
}),
function (results) {
if (err) throw err;
console.log(results);
this.next();
}
);
myFlow();
### parallel([Function tasks...]) -> Function
Return a function to execute tasks in parallel.
Arguments
tasks
: Optional. Tasks which are executed in parallel.Context
this
context of each task has following properties.
next
: Function. A function to complete a task and wait other tasks to complete.async
: Function. A function to accept parameters for a next task and return a callback, which complete a task and wait other tasks to complete.end
: Function. A function to execute a last task to end a control-flow. The first parameter is an error object.Example
var nue = require('nue');
var flow = nue.flow;
var parallel = nue.parallel;
var fs = require('fs');
var myFlow = flow(
function () {
this.next('file1', 'file2');
},
parallel(
function (name) {
var self = this;
fs.readFile(name, function (err, data) {
if (err) this.end(err);
self.next(data.length);
});
},
function (path) {
var self = this;
fs.stat(path, function (err, stats) {
if (err) this.end(err);
self.next(stats.isFile());
});
}
),
function (results) {
if (this.err) throw this.err;
console.log(results);
this.next();
}
);
myFlow();
### parallelMap(Function worker(arg)) -> Function
Return a function to process each value in parallel.
Arguments
worker
: Optional. Function. A function to process each value.arg
: Optional. Object. Each value passed from a previous task.Context
this
context of the worker
has following properties.
next
: Function. A function to complete a processing and wait other processing to complete.async
: Function. A function to accept parameters for a next task and return a callback, which complete a processing and wait other processing to complete.end
: Function. A function to execute a last task to end a control-flow. The first parameter is an error object.Example
var nue = require('nue');
var flow = nue.flow;
var parallelMap = nue.parallelMap;
var fs = require('fs');
var myFlow = flow(
function () {
this.next('file1', 'file2');
},
parallelMap(function (name) {
var self = this;
fs.readFile(name, function (err, data) {
if (err) this.end(err);
self.next(data.length);
});
}),
function (results) {
if (this.err) throw this.err;
console.log(results);
this.next();
}
);
myFlow();
FAQs
An async control-flow library suited for node.js.
The npm package nue receives a total of 1,216 weekly downloads. As such, nue popularity was classified as popular.
We found that nue 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.