DEV Community

Cover image for Build native NodeJS / Bun addons with Nim language, in seconds 👑
George Lemon
George Lemon

Posted on

2

Build native NodeJS / Bun addons with Nim language, in seconds 👑

This is DENIM! a little CLI monster and library that provides Nim bindings for writing safe and fast native NodeJS/Bun modules.

import denim

init proc(module: Module):
  proc hello(name: string): string {.export_napi} =
    return %*("Hello, " & args[0].getStr)
Enter fullscreen mode Exit fullscreen mode

In JavaScript:

const {hello} = require('./my.node');
console.log(hello("World!")) // Hello, World!
Enter fullscreen mode Exit fullscreen mode

That's it!

Check GitHub:
https://github.com/openpeeps/denim

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up