Registry / serialization / hexer
library0.0.2jsnpmunverified

Hexer is a Node.js library for generating hexadecimal dumps of buffers and streams, offering synchronous, streaming, and CLI modes. Its primary function is to transform binary data into a human-readable hex format, similar to tools like `xxd`. The package provides various transform streams for different use cases, including spying on stream data, converting entire streams, or processing data in chunks. Key customization options include control over output formatting like line prefixes, column count, grouping, and custom decorators for byte representation. The current stable version is 1.5.0, which was last published over 7 years ago, indicating it is no longer actively maintained. This means it primarily supports older CommonJS (CJS) environments and Node.js versions (engines require `>= 0.10.x`) and lacks native ES module (ESM) support or recent updates to align with modern JavaScript practices. Alternatives like `hexy` exist that are more actively maintained and support modern Node.js and ESM.

npm install hexer
INSTALL
IMPORT
SIG · HEXER
H
hexer
serializationjavascriptv0.0.2
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.

hex
const hex = require('hexer');
import hex from 'hexer';
Hexer is a CommonJS-only package. Native ES module imports are not supported. The main export is a function for dumping buffers.
hex.Spy
const hex = require('hexer'); // ... hex.Spy(process.stdout);
import { Spy } from 'hexer';
Named exports like `Spy` are properties of the main CommonJS `hex` export, not separate ES modules.
hex.Transform
const hex = require('hexer'); // ... hex.Transform();
import { Transform } from 'hexer';
Like `Spy`, `Transform` is a property of the main CommonJS `hex` export. It functions as a duplex stream.

Demonstrates basic usage of `hexer` to dump a Buffer to a string and to process a Readable stream with custom formatting options.

const hex = require('hexer'); const { Readable, Writable } = require('stream'); // Example 1: Buffer to string const someBuffer = Buffer.from('Hello, Hexer!'); console.log('Buffer dump:\n' + hex(someBuffer)); // Example 2: Streaming transform const inputData = Buffer.from('This is a test stream with some data.\nAnother line here.'); const readableStream = new Readable({ read() {} }); console.log('\nStreaming transform:'); readableStream .pipe(hex.Transform({ cols: 8, group: 4, headSep: '| ' })) .pipe(new Writable({ write(chunk, encoding, callback) { process.stdout.write(chunk.toString()); callback(); } })); readableStream.push(inputData.slice(0, 20)); readableStream.push(inputData.slice(20, 40)); readableStream.push(null); // End the stream
hexer --version
Debug
Known issues
breakingHexer is a CommonJS-only package and does not provide native ES module (ESM) support. Attempting to `import` it in an ESM project will result in a 'Module not found' or similar error.
fix
For ESM projects, use dynamic `import()` or consider a modern alternative like `hexy` that supports ESM. If using Node.js with `type: "module"` in `package.json`, you might need to wrap `require('hexer')` in an async function or use a compatibility layer if available.
affects: >=1.0.0
gotchaThe package has not been updated in over 7 years, and its `engines.node` field specifies `>= 0.10.x`. While it might still function on newer Node.js versions, it is not officially tested or supported for them and may encounter unexpected compatibility issues or rely on deprecated Node.js APIs.
fix
Evaluate compatibility through testing in your specific Node.js environment. For new projects or those requiring long-term stability and modern features, consider more actively maintained alternatives.
affects: >=1.5.0
Errors
Common errors & fixes
TypeError: hexer is not a function
Attempting to use `hexer` as a default export function after incorrectly importing it using `import hex from 'hexer';` in an ESM context, or incorrectly destructuring `require('hexer')`.
fix
Ensure you are using `const hex = require('hexer');` for CommonJS environments. The main `hex` function is the direct export of the module, while `Spy` and `Transform` are properties on it.
ERR_REQUIRE_ESM: Must use import to load ES Module
Attempting to `require('hexer')` in a Node.js environment where the current file or project is configured as an ES module (e.g., `"type": "module"` in `package.json`).
fix
Either convert your project or specific file to CommonJS, or use `const hex = await import('hexer').then(m => m.default || m);` for dynamic ESM import, though full compatibility isn't guaranteed. It's often better to use a modern, ESM-compatible hex dumping library.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
hexer — npm install hexer · libregistry