@eosrio/node-abieos

中文文档
4.2.0-f7d5b45发布于 2026/05/18MITTypeScriptESM + CJS零依赖近 30 天下载 2060

Node Bindings for abieos: Binary <> JSON conversion using ABIs.

原始使用文档
文档目录7 节
  1. Install
  2. Usage
  3. Building
  4. Linux
  5. Windows (MinGW-w64)
  6. macOS
  7. Documentation

node-abieos

CI Node-API v9 Badge NPM version Coverage Status

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.

Install

npm i @eosrio/node-abieos --save

Usage

CommonJS

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.ts

Bun

# examples/basic.mjs can be run with:
bun run examples/basic.mjs

Check the /examples folder for implementation examples

Building

Most users do not need this — the npm package ships prebuilt binaries for linux-x64, win32-x64, darwin-x64 and darwin-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 install

Linux

We recommend Clang 18 to build the abieos C++ library:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
npm run build:linux
npm run build

Windows (MinGW-w64)

abieos 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.

  1. Install MSYS2, then from an MSYS2 shell install the toolchain (any MinGW-w64 distribution with g++, ninja and dlltool works, e.g. WinLibs):

    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja
    
  2. Put the MinGW-w64 bin directory on PATH (e.g. C:\msys64\mingw64\bin) so g++, ninja and dlltool are resolvable.

  3. 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.

macOS

Install the Xcode Command Line Tools (provides Clang and libc++):

xcode-select --install
npm run build:mac
npm run build

Documentation

For 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.

版本与发布记录

@eosrio/node-abieos 共发布 26 个版本,首次发布于 2020/02/14;过去 12 个月发布了 2 个版本。

版本发布日期距今
4.2.0-f7d5b45latest2026/05/185 个月前
4.1.0-f7d5b452026/02/218 个月前
4.0.3-f7d5b452025/09/301.1 年前
4.0.2-20397172025/05/221.5 年前
4.0.1-2039717abieos2025/05/221.5 年前
4.0.0-20397172025/05/221.5 年前

关于 @eosrio/node-abieos 的常见问题

@eosrio/node-abieos 是什么?

Node Bindings for abieos: Binary <> JSON conversion using ABIs.

如何安装 @eosrio/node-abieos?

在项目目录运行 npm install @eosrio/node-abieos,或使用 pnpm add / yarn add / bun add。

@eosrio/node-abieos 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eosrio/node-abieos 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eosrio/node-abieos 可以商用吗?

@eosrio/node-abieos 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eosrio/node-abieos 的下载量有多少?

根据 npm 官方下载统计,@eosrio/node-abieos 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,060 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eosrio/node-abieos 还在维护吗?

最新版本 4.2.0-f7d5b45 发布于 2026/05/18(5 个月前);至今共发布 26 个版本,其中过去 12 个月发布了 2 个;首次发布于 2020/02/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。