Skip to main content
All platforms require Node.js 20.3.0 or newer. The JavaScript bindings to iroh are published on npm as @number0/iroh and shipped from iroh-ffi. They’re built with napi-rs, so the package distributes prebuilt native binaries. No Rust toolchain or local compilation is needed.

Install

Requires Node.js 20.3.0 or newer. Prebuilt N-API binaries are published for:
  • macOS: arm64 (no Intel build)
  • Linux: x86_64 and aarch64 (glibc + musl), armv7 (gnueabihf + musleabihf)
  • Windows: x86_64 and aarch64
  • Android: aarch64 and armv7

Hello, iroh

Endpoint.bind applies the n0 preset (public discovery + default relays) by default. Pass an EndpointOptions object to override the preset, supply a fixed secret key, or set ALPNs.

A two-peer echo

A minimal sender/receiver pair over a bidirectional stream:
Start the receiver in one terminal, copy the printed ticket, and run the sender with it in another.

Next steps

Connect two endpoints

Walkthrough of endpoints, tickets, and ALPNs with code samples in every language.

hello-iroh-ffi example app

A headless Node peer for the cross-platform dot demo. It speaks the same wire format as the Swift and Kotlin apps and prints received positions to the console.

JavaScript API reference

Generated TypeDoc reference for @number0/iroh.

iroh-ffi on GitHub

Source, examples, and issue tracker for the JavaScript (and other-language) bindings.