
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.
Fluorine - Flow based programing abstraction.
Fluorine can simply be though of as an abstraction or a DSL. It is a structure of code in which you can manage complex asynchronous code with ease.
Probably one of the most important features of Fluorine is its non-intrusive philosophy, since it separates code from structure.
This "structure" is though of as a flow within a graph, where each node in the graph is a function that runs some synchronous or asynchronous code.
Now, even though this sounds very simple, it is quite powerful, because you can code the "flow" which is the order in which functions will run, and then go ahead and code the behavior that will run within each node separately.
This simple fact, allows for clean, maintainable, simpler and atomic code. Removing callback-hells, nesting, smells, complexity.
You may not realize until you get there, but refactoring a flow consists of re-arranging the order of the nodes, while on the other hand you'll probaly produce a lot of bugs while trying to refactor all the mixed, nested complexity that lies in front of you. That is.. if you return alive from mordor.
Now, within the Fluorine world, the program is a graph, the execution of the program is called a flow and each node is called a step.
Let us Orchestrate asynchronous and synchronous code!
Basically you instantiate a flow. Then you add a step to the flow. Any step can have other steps as dependancies.
When the program runs, it will run each step only if all of its dependancies have been met.
Require the libraries needed for Fluorine
Suppose you need to execute two asynchronous functions (someAsyncFn, anotherAsyncFn) and when both are resolved execute something with the response of the previous asynchronous functions.
var flow = new Flow();
flow.step('bar')(function (step) {
someAsyncFn(function (someData) {
step.success(someData);
});
});
flow.step('baz')(function (step) {
anotherAsyncFn(function (moreData) {
step.success(moreData);
});
});
flow.step('foo').dependsOn('bar', 'baz')(function (step) {
// step.data.bar has someData as passed by the bar step
// step.data.baz has moreData as passed by the baz step
// Execute something else and then finish
step.success();
});
No more coupling async methods with unecessary nesting, let suppose you have fn1, fn2, fn3 and fn4 which are function that are asynchronous, and you want to call them in sequence after each other
Using nested callbacks
fn1(function () {
// execute some code
fn2(function () {
// more code
fn3(function () {
// ...
fn4(function () {
// finalize
});
});
});
});
Using Fluorine
var f = new Flow();
f.step('1')(function (step) {
// execute some code
fn1(step.success);
});
f.step('2').dependsOn('1')(function (step) {
// more code
fn2(step.success);
});
flow.step('3').dependsOn('2')(function (step) {
// ...
fn3(step.success);
});
flow.step('4').dependsOn('3')(function (step) {
// finalize
fn4(step.success);
});
Let run fn1, fn2 and fn3 and only execute fn4 after the previous funcitons finish
var f = new Flow();
f.step('1')(function (step) {
fn1(step.success);
});
f.step('2')(function (step) {
fn2(step.success);
});
f.step('3')(function (step) {
fn3(step.success);
});
f.step('4').dependsOn('1', '2', '3')(function (step) {
fn4(step.success);
});
Execute fn1 and fn2 then when both are ready execute fn3 and then fn4
var f = new Flow();
f.step('1')(function (step) {
fn1(step.success);
});
f.step('2')(function (step) {
fn2(step.success);
});
f.step('3').dependsOn('1', '2')(function (step) {
fn3(step.success);
});
f.step('4').dependsOn('3')(function (step) {
fn4(step.success);
});
FAQs
Fluorine node Package to run js flows better than promises
The npm package fluorine receives a total of 6 weekly downloads. As such, fluorine popularity was classified as not popular.
We found that fluorine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.