node-getopt is a minimalist command-line argument parser for Node.js, designed to mimic the traditional `getopt` utility. Currently at version 0.3.2, the package was last updated in 2013, indicating it is an abandoned project and no longer actively maintained. Its primary function is to define and parse both short and long options, supporting mandatory or optional arguments, and handling multiple occurrences of an option. It includes utilities for binding a 'help' option and generating usage messages. Its key differentiator at the time was its simplicity and close adherence to traditional `getopt` semantics for Node.js environments. Due to its age and reliance on very old Node.js versions (>=0.6.0), modern Node.js applications will likely find it incompatible or prefer more contemporary argument parsing libraries that support ESM and TypeScript.
npm install node-getoptVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to define command-line options, parse system arguments, and access the parsed options and remaining arguments using node-getopt.
Use `const Getopt = require('node-getopt');` in CommonJS modules. For ES module projects, consider using a more modern argument parsing library or a CJS-to-ESM wrapper if absolutely necessary.It is strongly recommended to use a currently maintained and actively developed command-line argument parser for any new or existing projects. This package should be considered for historical reference only.
If you must use this package in a TypeScript project, you will need to manually declare its types (e.g., `declare module 'node-getopt';`) or accept the lack of type safety. This further underscores the recommendation to use modern alternatives.
Ensure your file is treated as a CommonJS module (e.g., by using `.cjs` extension or `"type": "commonjs"` in `package.json`). Or, preferably, migrate to a modern CLI parser that supports ESM.
Install the package using `npm install node-getopt` or `yarn add node-getopt`.
No dependency data recorded yet.