Registry / http-networking / node-fingerprint

node-fingerprint

JSON →
library1.1.0jsnpmunverified

The `node-fingerprint` package provides a straightforward utility for generating a unique identifier for a Node.js process instance. It computes this fingerprint by hashing a combination of the process ID (`pid`) and the hostname of the machine it's running on. This design is explicitly inspired by concepts found in `cuid` for generating short, unique IDs. The current stable version is 1.1.0, which was last published over a decade ago in August 2015, indicating that the project is no longer actively maintained. Its primary use case is for simple, local process identification within a single machine's context, rather than for global or persistent unique identifiers, or browser-based fingerprinting offered by other, more complex solutions like FingerprintJS. It distinguishes itself by its extreme simplicity and minimal dependencies, focusing solely on the OS-level process and host information.

npm install node-fingerprint
INSTALL
IMPORT
SIG · NODE-FINGERPRINT
N
node-fingerprint
http-networkingjavascriptv1.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fingerprint
const generateFingerprint = require('node-fingerprint'); const fingerprint = generateFingerprint();
import generateFingerprint from 'node-fingerprint'; const fingerprint = generateFingerprint();
This package is CommonJS-only. Direct ES module `import` syntax will fail without a CommonJS wrapper or bundler configuration. The package exports a function, which must then be invoked to get the actual fingerprint string.
generateFingerprintFunction
const generate = require('node-fingerprint'); const myProcessFingerprint = generate();
const { generate } = require('node-fingerprint');
The package exports a default function. Destructuring will not work as there are no named exports. The `require` call directly returns the function that generates the fingerprint.

Demonstrates how to import and immediately use the `node-fingerprint` package to get a process identifier.

const generateFingerprint = require('node-fingerprint'); // Get the current process's fingerprint const fingerprint = generateFingerprint(); console.log(`Node.js Process Fingerprint: ${fingerprint}`); console.log('This fingerprint is derived from the process ID (pid) and hostname.'); console.log('It will change if the process restarts or runs on a different machine.'); // Example of how it would be different if run multiple times (simulated) const anotherFingerprint = generateFingerprint(); console.log(`Another (simulated) fingerprint call: ${anotherFingerprint}`);
Debug
Known issues
gotchaThe fingerprint generated by `node-fingerprint` is based on the process ID (pid) and hostname. This means the fingerprint is NOT stable across process restarts, different machines, or even potentially different containers/virtual environments where pid or hostname might differ. It is intended for identifying a *running instance*.
fix
Do not rely on this fingerprint for persistent machine identification, user tracking, or cross-machine unique identification. For persistent or device-level fingerprints, consider alternatives like `hw-fingerprint` or external services.
affects: >=1.0.0
deprecatedThe `node-fingerprint` package has not been updated in over a decade (last published August 2015). This means it likely does not incorporate modern Node.js features, security fixes, or performance improvements, and may have compatibility issues with very recent Node.js versions or project configurations.
fix
Evaluate alternatives if long-term maintenance, modern Node.js compatibility, or updated security practices are critical for your application. For robust unique identification, consider actively maintained libraries or services, or implement a custom solution that hashes more stable system parameters if truly necessary.
affects: >=1.0.0
gotchaThis package uses CommonJS (`require`) exclusively. Modern Node.js projects often use ES Modules (`import`). Attempting to `import` this package directly in an ES Module context will result in an error unless proper interoperability is configured.
fix
For ES Module projects, either stick to `const myModule = require('node-fingerprint');` or configure your build system (e.g., Webpack, Rollup) or Node.js environment (`type: module` in `package.json` with appropriate transpilation/loaders) to handle CommonJS imports. For simple scripts, changing your file extension to `.cjs` or using a `createRequire` helper might work.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: require(...) is not a function
The `require('node-fingerprint')` call returns a function, which then needs to be invoked to get the fingerprint string. The user might be trying to use it directly as the fingerprint string.
fix
Ensure you call the function returned by `require`. Correct usage: `const getFingerprint = require('node-fingerprint'); const fingerprint = getFingerprint();`
ERR_REQUIRE_ESM
Attempting to `import` the `node-fingerprint` package in an ES Module project. This package is CommonJS-only and does not provide an ES Module entry point.
fix
In an ES Module context, use `const createRequire = require('module').createRequire; const requireFingerprint = createRequire(import.meta.url); const generateFingerprint = requireFingerprint('node-fingerprint'); const fingerprint = generateFingerprint();` or switch back to CommonJS for the file importing it.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
node-fingerprint — npm install node-fingerprint · libregistry