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

@sie-js/ptr89

v3.0.3

Published

ARM/THUMB/C166 binary pattern finder

Readme

NPM Version

JavaScript module

Install the package with pnpm:

pnpm add @sie-js/ptr89

Example

import { readFile } from "node:fs/promises";
import { Ptr89 } from "@sie-js/ptr89";

const fullflash = await readFile("EL71v45.bin");
const ptr89 = new Ptr89();
await ptr89.open(fullflash, { arch: "arm" });

const search = ptr89.find("F0B5061C0C1C151C85B068461122??49", 1);
const xrefs = ptr89.findXRefs(0xA04CA048, 3);

ptr89.close();

API

new Ptr89()

Creates a pattern finder. Call open() before searching.

open(data, options?)

type Ptr89Arch = "arm" | "c166";

interface Ptr89OpenOptions {
	arch?: Ptr89Arch;
	base?: number;
}

open(data: Uint8Array, options?: Ptr89OpenOptions): Promise<void>;

Copies a fullflash into WebAssembly memory. The input buffer is no longer needed after the promise resolves. Calling open() again replaces the current fullflash. Node.js Buffer values can be passed directly because Buffer extends Uint8Array.

  • arch selects the instruction decoder. Default: "arm".
  • base sets the load address. The ARM default is 0xA0000000. For C166 it is calculated as 0x1000000 - data.byteLength.

openFile(file, options?)

openFile(file: Blob, options?: Ptr89OpenOptions): Promise<void>;

Reads a File or Blob directly into WebAssembly memory. Options are the same as for open().

find(pattern, limit?, align?)

find(pattern: string, limit?: number, align?: number): Ptr89Search;

Finds one pattern in the opened fullflash. The default limit is 100; a limit of 0 disables it. The default alignment is 1. The returned object has the same shape as one entry in the CLI -J patterns array:

type Ptr89SearchType = "address" | "pointer" | "reference" | "branch";

interface Ptr89Search {
	pattern: string;
	type: Ptr89SearchType;
	results: Ptr89SearchResult[];
}

interface Ptr89SearchResult {
	address: number;
	offset?: number;
	bytes?: string;
}

address is the resolved address, pointer value or decoded target. For a regular pattern, offset points to the matched bytes. For other results it is address - base and is omitted when address is outside the fullflash. bytes is returned only for a regular pattern result.

findXRefs(address, limit?)

findXRefs(address: number, limit?: number): Ptr89XRef[];

Finds branches, decoded references and stored pointers to a 32-bit address. C166 code and data pointers are both supported. The default limit is 100; a limit of 0 disables it:

type Ptr89XRefType = "pointer" | "reference" | "branch";

interface Ptr89XRef {
	type: Ptr89XRefType;
	xref: number;
	offset: number;
}

setDebug(enabled)

setDebug(enabled: boolean): void;

Enables or disables decoder and pattern-matching logs from the WebAssembly module.

close()

close(): void;

Releases the copied fullflash and the underlying Embind object. Calling it more than once is safe.

prettify(pattern)

prettify(pattern: string): Promise<string>;

Parses a pattern and returns its normalized representation. Invalid patterns reject the promise with a syntax error.

All addresses and offsets are unsigned 32-bit numbers represented as JavaScript number values.

Building from sources

Build the WebAssembly module from sources:

pnpm run build:wasm

The build produces ptr89_wasm.js, ptr89_wasm.wasm and ptr89_wasm.d.ts in build-wasm/.