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

node-lief

v1.1.1

Published

Node.js bindings for LIEF, a library to parse and manipulate ELF, PE, and Mach-O executables.

Readme

node-lief

Coverage

Node.js bindings for LIEF, a library to parse and manipulate ELF, PE, and Mach-O executables. We use it in production in tweakcc, and it's also used in community projects like claude-depester.

These bindings were largely generated by Claude, and have 97%+ coverage. Most of the APIs are currently used in tweakcc.

Installation

# npm
npm install node-lief

# yarn
yarn add node-lief

# pnpm
pnpm add node-lief

Usage

import LIEF from 'node-lief';

// Parse any binary (format is auto-detected)
const binary = LIEF.parse('/bin/ls');

console.log(binary.format);     // 'ELF' | 'PE' | 'MachO'
console.log(binary.entrypoint); // 0x1234n (bigint)
console.log(binary.isPie);      // true

// Iterate sections
for (const section of binary.sections()) {
  console.log(section.name, section.virtualAddress);
}

// Modify and write
binary.patchAddress(0x1000n, [0x90, 0x90, 0x90]);
binary.write('./patched');

Format-specific APIs

import LIEF from 'node-lief';

// Mach-O: Handle universal binaries and code signatures
const fat = LIEF.MachO.parse('./macho-binary');
const binary = fat.at(0) as LIEF.MachO.Binary;

if (binary.hasCodeSignature) {
  binary.removeSignature();
}

const segment = binary.getSegment('__TEXT');
const section = segment?.getSection('__text');
console.log(section?.content); // Buffer

// ELF: Access overlay data
const elf = LIEF.parse('./elf-binary') as LIEF.ELF.Binary;
if (elf.hasOverlay) {
  console.log(elf.overlay); // Buffer
}

// PE: Work with sections
const pe = LIEF.parse('./pe-binary') as LIEF.PE.Binary;
const peSection = pe.getSection('.text');
console.log(peSection?.virtualSize);

API

LIEF.parse(path: string) — Parse a binary and return a format-specific Binary object.

LIEF.MachO.parse(path: string) — Parse a Mach-O file, returning a FatBinary (handles universal binaries).

Binary properties and methods

| Property/Method | Description | |-----------------|-------------| | format | 'ELF' | 'PE' | 'MachO' | 'UNKNOWN' | | entrypoint | Entry point address (bigint) | | isPie | Position-independent executable | | hasNx | NX (non-executable stack) protection | | sections() | Array of sections | | symbols() | Array of symbols | | getSymbol(name) | Get symbol by name | | patchAddress(addr, bytes) | Patch bytes at address | | write(path) | Write binary to disk |

Format-specific APIs

| Format | Additional APIs | |--------|-----------------| | ELF | hasOverlay, overlay (Buffer) | | PE | optionalHeader, getSection(name), section.virtualSize | | MachO | header, hasCodeSignature, getSegment(name), removeSignature(), extendSegment() |

Logging

LIEF.logging.disable(); // Silence LIEF output
LIEF.logging.enable();

Supported platforms

| Platform | Architectures | |----------|---------------| | Linux | x64, arm64 | | macOS 13+ | x64, arm64 | | Windows | x64, arm64 |

License

Apache-2.0 © 2025-2026 Piebald LLC