{"library":"node-nailgun-client","title":"Node.js Nailgun Client","description":"node-nailgun-client provides a Node.js API and command-line interface (CLI) for interacting with a Nailgun server. Nailgun is a system designed to run Java programs from the command line without incurring the typical JVM startup overhead, acting as a long-running JVM server that executes commands sent from a client. This package allows Node.js applications to programmatically execute Java code via the Nailgun protocol. The current and only stable version is 0.1.2, last published over seven years ago. The package's development is abandoned, coinciding with the upstream Nailgun project itself being officially unmaintained since April 2023. Key differentiators included its attempt to integrate high-performance Java execution within Node.js workflows by leveraging Nailgun's persistent JVM model.","language":"javascript","status":"abandoned","last_verified":"Tue Apr 21","install":{"commands":["npm install node-nailgun-client"],"cli":{"name":"ng","version":null}},"imports":["const nailgunClient = require('node-nailgun-client');","const nail = nailgunClient.exec('command-name', args, options);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const nailgunClient = require('node-nailgun-client');\n\n// Basic execution of a Nailgun command (e.g., 'ng-stats' for server status)\nconst simpleNail = nailgunClient.exec('ng-stats');\nsimpleNail.stdout.pipe(process.stdout);\nsimpleNail.stderr.pipe(process.stderr);\nsimpleNail.on('exit', (code) => {\n  if (code !== 0) {\n    console.error(`ng-stats exited with code ${code}`);\n  }\n});\n\n// Executing a custom Java class with arguments and explicit server options\nconst options = {\n  address: 'localhost',\n  port: 2113\n};\nconst args = ['hello', 'world'];\n\nconst customNail = nailgunClient.exec('com.example.MyJavaClass', args, options);\n\ncustomNail.stdout.pipe(process.stdout); // Pipe Java's stdout to Node's stdout\ncustomNail.stderr.pipe(process.stderr); // Pipe Java's stderr to Node's stderr\n\n// Optionally pipe Node's stdin to Java's stdin if the Java program expects input\n// process.stdin.pipe(customNail.stdin);\n\ncustomNail.on('exit', (code) => {\n  console.log(`Java program exited with code ${code}`);\n  // process.exit(code); // Uncomment to exit Node.js with the Java program's exit code\n});","lang":"javascript","description":"Demonstrates how to execute a basic Nailgun command and a custom Java class with arguments and server configuration, handling I/O streams and exit codes.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}