Node.js native binding for abieos, with some improvements:
- Internal loaded contract map
- deleteContract: to remove the loaded contract from memory (now in vanilla abieos too)
Made with ♥ by EOS Rio
Linux, Windows and macOS are supported. The npm package bundles a prebuilt
binary per platform (abieos-<platform>-<arch>.node) and the loader picks the
right one at runtime — npm i is zero-build on supported platforms. Building
from source is only needed for unsupported platform/arch combinations or local
development (see Building).
- Typescript typings included
- Prebuilt binaries bundled:
linux-x64,win32-x64,darwin-x64,darwin-arm64(loaded automatically by platform/arch) - Windows builds with MinGW-w64 (GCC) — MSVC is not supported: the bundled abieos C++ requires libstdc++/libc++ semantics MSVC's STL lacks
- macOS builds with the Xcode Command Line Tools (Clang/libc++)
- Now supports NodeJS, Deno, and Bun runtimes.
npm i @eosrio/node-abieos --saveCommonJS
const nodeAbieos = require('@eosrio/node-abieos');ES Modules (NodeJS, Bun)
import {Abieos} from "@eosrio/node-abieos";
const abieos = Abieos.getInstance();Deno
# examples/basic.cjs can be run with:
deno run --allow-ffi --allow-read examples/basic.cjs
# For an example using the published npm package with Deno:
# Check the examples/deno-abieos-test folder
cd examples/deno-abieos-test
deno run --allow-ffi --allow-read main.tsBun
# examples/basic.mjs can be run with:
bun run examples/basic.mjsCheck the /examples folder for implementation examples
Most users do not need this — the npm package ships prebuilt binaries for
linux-x64,win32-x64,darwin-x64anddarwin-arm64. Build from source only for an unsupported platform/arch or for local development.
Clone with submodules first (required on every platform):
git clone https://github.com/eosrio/node-abieos.git --recursive
cd node-abieos
npm installWe recommend Clang 18 to build the abieos C++ library:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18npm run build:linux
npm run buildabieos does not build with MSVC — its C++ depends on libstdc++/libc++
standard-library semantics and GCC/Clang extensions that MSVC's STL/compiler do
not provide, and this is not patchable in the vendored submodule. Build with
MinGW-w64 (GCC) instead.
-
Install MSYS2, then from an MSYS2 shell install the toolchain (any MinGW-w64 distribution with
g++,ninjaanddlltoolworks, e.g. WinLibs):pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja
-
Put the MinGW-w64
bindirectory onPATH(e.g.C:\msys64\mingw64\bin) sog++,ninjaanddlltoolare resolvable. -
Build:
npm run build:win npm run build
build:win drives cmake-js with the Ninja generator and synthesizes a GNU
import library for the Node-API symbols, so the resulting .node loads in the
standard (MSVC-built) Node.js for Windows.
Install the Xcode Command Line Tools (provides Clang and libc++):
xcode-select --installnpm run build:mac
npm run buildFor detailed and user-friendly documentation, including installation, usage, API reference, error handling, debugging, and examples, please refer to the documentation.
For contribution guidelines and developer documentation, refer to the contribution guidelines.