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 🙏

© 2025 – Pkg Stats / Ryan Hefner

koffi-cream

v2.14.1

Published

A lighter packaging for Koffi, the fast and simple C FFI (foreign function interface) for Node.js

Readme

koffi-cream

A lighter packaging of Niels Martignène's excellent Koffi.

Just npm install koffi-cream instead of koffi and use it like the real thing:

import koffi from 'koffi-cream'

const lib = koffi.lib('some_lib')
const some_func = lib.func('int some_func(int a, int b)')
// etc.

[!IMPORTANT] This package is neither a fork nor a patch. It is the original Koffi, only packaged differently to avoid downloading a megalithic[^1] package bloated with files unnecessary to the average user[^2].

[^1]: As of 2.14.0, Koffi weights 16.9 MB compressed and 86 MB uncompressed. [^2]: Koffi's package includes 18 natives binaries (of which 17 are not compatible with your platform), the build tools and the full source code.

The why and the how

The discussion at https://github.com/Koromix/koffi/issues/201 explains why I decided to create koffi-cream.

koffi-cream repackages Koffi using the same strategy as many popular packages in the JavaScript community like esbuild or swc: by leveraging the optionalDependencies, os, cpu and libc properties in package.json.

This way, when you install koffi-cream, your package manager will only download and install the build that is right for your platform. For example, on Windows AMD/Intel 64 bit, your package manager will install:

  • koffi-cream (this package): 5.1 kB compressed / 19.8 kB uncompressed
  • @septh/koffi-win32-x64: 536.2 kB compressed / 2.4 MB uncompressed

That's 74.2% off compared to the original Koffi package!

[!NOTE] The os and cpu are standard properties, supported by all package managers. But the libc property, used to distinguish Linux distros between gnu and musl, is newer and only supported by npm 10.4.0 and later, pnpm 7.1.0 and later, and yarn 3.2.0 and later.

Available packages

koffi-cream only offers a subset of Koffi's 18 native builds:

| Koffi binary | koffi-cream package | |---------------|--------------------------------------------------------------------------------------------| | darwin-arm64 | @septh/koffi-darwin-arm64 | | darwin-x64 | @septh/koffi-darwin-x64 | | freebsd-arm64 | @septh/koffi-freebsd-arm64 | | freebsd-ia32 | ❌ | | freebsd-x64 | @septh/koffi-freebsd-x64 | | linux-arm64 | @septh/koffi-linux-arm64-glibc | | linux-armhf | ❌ | | linux-ia32 | ❌ | | linux-loong64 | @septh/koffi-linux-loong64 | | linux-riscv64 | @septh/koffi-linux-riscv64 | | linux-x64 | @septh/koffi-linux-x64-glibc | | musl-arm64 | @septh/koffi-linux-arm64-musl | | musl-x64 | @septh/koffi-linux-x64-musl | | openbsd-ia32 | ❌ | | openbsd-x64 | @septh/koffi-openbsd-x64 | | win32-arm64 | @septh/koffi-win32-arm64 | | win32-ia32 | ❌ | | win32-x64 | @septh/koffi-win32-x64 |

I do not plan to add the missing builds. If you need one of these, you'll have to stick with Koffi.

Version numbering

To make things easy on the user, koffi-cream's version number will always be aligned with Koffi's.

Hence, there is no koffi-cream 1.x or 2.0; the first version published is 2.11.0 which ships with Koffi's 2.11.0 binaries.

Related

  • libwin32: Node bindings to native Win32 DLLs through ~~Koffi~~ koffi-cream.

License

MIT