Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@lucidsoftware/nodegun
Advanced tools
Nailgun for Node.js
Nodegun improve start up overhead for Node.js programs.
// helloworld.js
console.log('Hello world');
$ time node helloworld.js
Hello world
real 0m0.102s
$ time ng helloworld.js
Hello world
real 0m0.004s
Nodegun is inspired by Nailgun, a system for reducing startup overhead of Java programs. Users invoke a small executable (written in C), which connects to a long-running JVM server where the work is actually performed.
Nodegun is a Node.js server implementation of the Nailgun protocol. Users connect with the same native client, which submits work to the server.
Nodegun can run either as a single process, as master-worker for parallelized workloads:
$ apt-get install nailgun
$ npm install -g nodegun
$ nodegun
// example_nail.js
console.log(process.argv.slice(2).join('-'));
$ ng example_nail The Fast and the Furious
$ # (or ng-nailgun ...)
The-Fast-and-the-Furious
Most Node.JS programs should work as nails without modification. Nodegun adjusts the runtime environment, including
process.argv
process.env
process.exit
process.stdin
, process.stdout
, process.stderr
The most significant requirement: Nails must clean up after themselves. They must not corrupt state, create memory leaks, etc.
The root nail module and re-run each time. Modules required by the nail module are run only once. In both cases, code
is cached via the standard require
mechanism. The server must be restarted if nails are updated on disk.
Nodegun resolves the requested nail
node
would do, i.e. relative to the current directory.require
would do from nodegun process.Each worker process (or the main process, if there are no workers) runs only one nail at a time.
Nodegun comes with a few built-in nails, including
ng ./examples/hello
- Print Hello World
ng ./examples/info
- Print arguments and working direcotryng ./examples/echo
- Copy stdin to stdoutWe use Nodegun in our build system. A fast CLI to Node.js amenable to in concurrent, polyglot build systems.
In this way, it is similar to Nailgun, which is used in build tools like Buck and Pants.
usage: main.js [-h] [-v] [--tcp [TCP] | --local [LOCAL]]
[--status-tcp TCP | --status-local LOCAL] [--workers [WORKERS]]
Node.js server that supports the Nailgun protocol.
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show program's version number and exit.
--workers [WORKERS] If present, number of worker processes to start. A
flag with no argument starts one per CPU.
Transport:
Transport and address. TCP is used by default.
--tcp [TCP] TCP address to listen to, given as ip, port, or
ip:port. IP defaults to 0.0.0.0, and port defaults to
2113.
--local [LOCAL] Local address to listen to. Defaults to /tmp/nodegun.
sock.
Status:
Optionally expose internal status information via HTTP server.
--status-tcp TCP TCP address to listen to for status, given as ip,
port, or ip:port. IP defaults to 0.0.0.0.
--status-local LOCAL Local address to listen to for status.
FAQs
Node.js server supporting the Nailgun protocol
The npm package @lucidsoftware/nodegun receives a total of 30 weekly downloads. As such, @lucidsoftware/nodegun popularity was classified as not popular.
We found that @lucidsoftware/nodegun 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.