
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
This is a collection of non-portable *nix functions.
Ryan has stated that he does not want anything in node that cannot be ported to windows. So I have started this addon for *nix functions that are commonly found in the standard libraries of other languages.
Feel free to suggest additional functions via pull requests / issue tickets!
To install this package, simply run:
npm install nix
Using this module, forking a running node.js process is as simple as:
var nix = require('nix');
var pid = nix.fork();
if (pid == 0) {
// this is the child process, pid = 0
} else {
// this is the parent process, pid = child pid
}
Calling this after creating and listening on a simple http/tcp server should work as expected for most parts. That is, requests will be randomly distributed to the new child and parent process by the kernel.
However, if you plan on calling this during a tcp/http request, make sure that
you destroy() this stream in either the parent or the child. Otherwise
both of them will try to watch the socket, causing packets to randomly be
seen by either process.
A binding to fork(2).
Returns 0 for the child process and the pid of the child process for the
parent.
This function will create a new child process that is an identical copy of the parent process. All I/O watchers will be left in-tact, so you need to understand what this means when calling this function during the runtime phase of your program.
This function is blocking and takes ~3-4ms per call in my benchmarks. Making it non-blocking would be rather stupid idea.
Warning: Do not call this function from the repl on OSX, unless you want to trigger a kernel panic.
node-nix is licensed under the MIT license.
FAQs
Node.js bindings for non-portable *nix functions
We found that nix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.