Skip to content

rmw-link/nestedtext-zig-nodejs

Repository files navigation

napi.zig

tiny and fast node-api bindings for zig

Features

  • 🚀 async functions run in parallel
  • ⛓️ expose c and zig functions to js
  • 🔨 does not require node-gyp to build
  • [WIP] ✨ seamless serde between js and zig types
  • 🎯 compile to any architecture with zig cross-compilation

Examples

more examples in examples/ folder

const std = @import("std");
const napi = @import("./src/napi.zig");
const allocator = std.heap.c_allocator;

comptime {
  napi.register(init);
}

fn init(env: napi.env, exports: napi.object) !void {
  try exports.set(env, "add", try napi.bind.function(env, add, "add", allocator));
}

fn add(a: u32, b: u32) u32 {
  return a + b;
}

License

MIT © Evan

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published