npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xxd-wasm

v1.0.1

Published

xxd hex dump utility compiled to WebAssembly - works in browsers and Node.js

Readme

xxd-wasm

The classic xxd hex dump utility, compiled to WebAssembly. Works in browsers and Node.js.

npm version license

Features

  • Full xxd compatibility - All standard options supported
  • Tiny size - Only 25KB WASM + 60KB JS
  • Zero dependencies - Self-contained module
  • TypeScript support - Full type definitions included
  • Dual module - Works with CommonJS and ESM

Installation

npm install xxd-wasm

Quick Start

import { createXxd } from 'xxd-wasm';

const xxd = await createXxd();

// Write some data
xxd.FS.writeFile('/input.bin', new TextEncoder().encode('Hello, World!'));

// Run xxd
xxd.callMain(['/input.bin']);
// Output: 00000000: 4865 6c6c 6f2c 2057 6f72 6c64 21  Hello, World!

Usage

Capturing Output

let output = '';

const xxd = await createXxd({
    print: (text) => { output += text + '\n'; },
    printErr: (text) => { console.error(text); }
});

xxd.FS.writeFile('/data.bin', new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]));
xxd.callMain(['-p', '/data.bin']);

console.log(output); // "48656c6c6f\n"

Plain Hex Output

xxd.callMain(['-p', '/input.bin']);
// Output: 48656c6c6f2c20576f726c6421

C Include Format

xxd.callMain(['-i', '/image.png', '/image.h']);

const header = xxd.FS.readFile('/image.h', { encoding: 'utf8' });
// Output:
// unsigned char _image_png[] = {
//   0x89, 0x50, 0x4e, 0x47, ...
// };
// unsigned int _image_png_len = 1234;

Reverse: Hex to Binary

xxd.FS.writeFile('/hex.txt', '48656c6c6f');
xxd.callMain(['-r', '-p', '/hex.txt', '/output.bin']);

const binary = xxd.FS.readFile('/output.bin');
console.log(new TextDecoder().decode(binary)); // "Hello"

Binary Dump

xxd.callMain(['-b', '/input.bin']);
// Output: 00000000: 01001000 01100101 01101100 01101100 01101111  Hello

API Reference

createXxd(options?)

Creates an xxd instance.

Options:

  • print(text: string) - Handler for stdout (default: console.log)
  • printErr(text: string) - Handler for stderr (default: console.error)

Returns: Promise<XxdModule>

xxd.callMain(args: string[])

Run xxd with command-line arguments.

Returns: Exit code (0 = success)

xxd.FS.writeFile(path, data)

Write data to the virtual filesystem.

  • path - File path (e.g., '/input.bin')
  • data - string or Uint8Array

xxd.FS.readFile(path, options?)

Read a file from the virtual filesystem.

  • path - File path
  • options.encoding - Set to 'utf8' to return string

Returns: Uint8Array or string

xxd.FS.unlink(path)

Delete a file from the virtual filesystem.

Command-Line Options

| Option | Description | |--------|-------------| | -a | Toggle autoskip: * replaces nul-lines | | -b | Binary digit dump (bits instead of hex) | | -c cols | Format <cols> octets per line (default: 16) | | -C | Capitalize variable names in C output | | -d | Show offset in decimal instead of hex | | -e | Little-endian dump | | -E | Show characters in EBCDIC | | -g bytes | Group octets (default: 2) | | -i | Output in C include file style | | -l len | Stop after <len> bytes | | -n name | Set variable name for C output | | -o off | Add <off> to displayed offset | | -p | Plain hexdump style | | -r | Reverse: convert hex to binary | | -s seek | Start at <seek> bytes offset | | -u | Use uppercase hex letters |

Browser Usage

<script type="module">
import { createXxd } from 'https://unpkg.com/xxd-wasm/dist/xxd.mjs';

const xxd = await createXxd();
// ... use xxd
</script>

Or with a bundler:

import { createXxd } from 'xxd-wasm';

Node.js Usage

const { createXxd } = require('xxd-wasm');
// or
import { createXxd } from 'xxd-wasm';

const xxd = await createXxd();

// Read a real file
const fs = require('fs');
const data = fs.readFileSync('myfile.bin');

xxd.FS.writeFile('/myfile.bin', data);
xxd.callMain(['/myfile.bin']);

Building from Source

Requires Emscripten.

git clone https://github.com/avaitla/xxd-wasm.git
cd xxd-wasm

# Build everything
make all

# Or just the npm package
make npm

# Run tests
make test

Disclaimer

This project was created as a learning exercise to understand WebAssembly porting. The WebAssembly port, npm package, and web demo were primarily written by Claude (Anthropic's AI assistant), with human guidance and review.

License

Dual-licensed under MIT or GPL-2.0 (at your choice), same as the original xxd.

Original xxd by Juergen Weigert, with contributions from Bram Moolenaar et al.

Links