Napi.zig Save

tiny and fast napi bindings for zig

Project README

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

Open Source Agenda is not affiliated with "Napi.zig" Project. README Source: evanwashere/napi.zig
Stars
69
Open Issues
0
Last Commit
2 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating