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

llvmc

v1.0.2

Published

LLVM bindings via the C API

Downloads

25

Readme

node-llvmc

These are bindings to the LLVM C API for Node.js, written in TypeScript using node-ffi.

Setting Up

You will need an installation of LLVM that includes its shared library, which is called libLLVM.so or libLLVM.dylib. On macOS, for example, Xcode does not ship with the shared library, but the Homebrew package for LLVM does. If you build LLVM yourself, set LLVM_BUILD_LLVM_DYLIB=On to get the shared library.

Next, the dynamic linker will need to be able to find the shared library. If you installed LLVM with Homebrew, for example, try this:

$ export LD_LIBRARY_PATH=`brew --prefix llvm`/lib

to put the appropriate "keg-only" library directory on your linker path.

You should now be able to install and require the llvmc library. Installation works in the usual way:

$ yarn add llvmc
(or)
$ npm install --save llvmc

Examples

This repository contains two examples. You can build them by cloning this repository and then running:

$ cd node-llvmc
$ yarn  # Install the dependencies.
$ cd example
$ tsc  # Compile the examples.

The first example is really simple, but it shows all the pieces you need to generate LLVM IR. Type this to see it in action:

$ node build/example/basic.js

You'll see textual LLVM IR dumped to standard output, and the script will also write LLVM bitcode to a file out.bc. You can type clang out.bc to compile the program to native code and then ./a.out to execute it.

We have also included a more complex example based on LLVM's venerable Kaleidoscope tutorial. See the example's README for an introduction.

Using the Bindings

There are two ways to use the library: a low-level interface and a set of friendlier wrapper classes.

Low-Level Bindings

To use the direct bindings to the LLVM C API functions, import the LLVM object from the llvmc module. You can invoke the C API functions as methods on this object:

import { LLVM } from 'llvmc';
let mod = LLVM.LLVMModuleCreateWithName("some_module");
// ...
let ir = LLVM.LLVMPrintModuleToString(mod);
console.log(ir);
LLVM.LLVMDisposeModule(mod);

This low-level interface does not have useful TypeScript annotations (yet).

Higher-Level, Object-Oriented Interface

This library also provides ES2015 class wrappers for LLVM objects. These wrappers do come with TypeScript types, which enable completion and static checking. You can import these classes, such as Module, from the library:

import * as llvmc from 'llvmc';
let mod = llvmc.Module.create("some_module");
// ...
console.log(mod.toString());
mod.free();

Someday, we will generate documentation for this suite of classes.

Other Projects

Here are the other LLVM bindings I could find:

  • llvm2: Another FFI-based binding to the C API.
  • node-llvm: Bindings using a compiled extension.
  • petard: Another compiled extension, also focused on IR generation.

Credits

This is a project of Capra at Cornell. It was written by Adrian Sampson and Richie Henwood. The license is MIT.