npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dbus.js

v0.1.0

Published

D-bus protocol implementation in native javascript

Readme

dbus.js

D-Bus (short for "Desktop Bus") is a message-oriented middleware mechanism that allows communication between multiple processes running concurrently on the same machine. D-Bus was developed as part of the freedesktop.org project, initiated by GNOME developer Havoc Pennington to standardize services provided by Linux desktop environments such as GNOME and KDE Plasma.

https://en.wikipedia.org/wiki/D-Bus

dbus.js is a JavaScrpt library for D-Bus.

This is a fork of dbus-native that brings:

  • replace callbacks with async / await
  • migrate from commonjs to ESM
  • replace abstract-socket dependency with Node.js builtin support
  • update dependencies
  • misleading EventEmitter API replaced
    • on/addListener -> subscribe()
    • off/removeListener -> unsubscribe()
    • emit -> signal()
npm install dbus.js
import dbus from "dbus.js";

const bus = dbus.sessionBus();
const service = bus.getService("org.freedesktop.Notifications");
const iface = await service.getInterface(
  "/org/freedesktop/Notifications",
  "org.freedesktop.Notifications",
);
console.log(iface);

await iface.subscribe("ActionInvoked", (...args) => {
  console.log("ActionInvoked", ...args);
});

await iface.subscribe("NotificationClosed", (...args) => {
  console.log("NotificationClosed", ...args);
});

const [id] = await iface.Notify(
  "exampl",
  0,
  "",
  "summary 3",
  "new message text",
  ["xxx yyy", "test2", "test3", "test4"],
  [],
  5,
);
console.log("Notificaton id", id);

setTimeout(() => iface.CloseNotification(id), 4000);

API

Low level messaging: bus connection

connection = dbus.createClient(options)

options:

  • socket - unix socket path
  • port - TCP port
  • host - TCP host
  • busAddress - encoded bus address. Default is DBUS_SESSION_BUS_ADDRESS environment variable. See http://dbus.freedesktop.org/doc/dbus-specification.html#addresses
  • authMethods - array of authentication methods, which are attempted in the order provided (default:['EXTERNAL', 'DBUS_COOKIE_SHA1', 'ANONYMOUS'])
  • ayBuffer - boolean (default:true): if true 'ay' dbus fields are returned as buffers
  • ReturnLongjs - boolean (default:false): if true 64 bit dbus fields (x/t) are read out as Long.js objects, otherwise they are converted to numbers (which should be good up to 53 bits)

connection has only one method, message(msg)

message fields:

  • type - methodCall, methodReturn, error or signal
  • path - object path
  • interface
  • destination
  • sender
  • member
  • serial
  • signature
  • body
  • errorName
  • replySerial

connection signals:

  • connect - emitted after successful authentication
  • message
  • error

example:

import dbus from "dbus.js";
const conn = dbus.createConnection();
conn.message({
    path:'/org/freedesktop/DBus',
    destination: 'org.freedesktop.DBus',
    'interface': 'org.freedesktop.DBus',
    member: 'Hello',
    type: dbus.messageType.methodCall
});
conn.on('message', (msg) => {
  console.log(msg);
});

Note on INT64 'x' and UINT64 't'

Long.js is used for 64 Bit support. https://github.com/dcodeIO/long.js The following javascript types can be marshalled into 64 bit dbus fields:

  • typeof 'number' up to 53bits
  • typeof 'string' (consisting of decimal digits with no separators or '0x' prefixed hexadecimal) up to full 64bit range
  • Long.js objects (or object with compatible properties)

By default 64 bit dbus fields are unmarshalled into a 'number' (with precision loss beyond 53 bits). Use {ReturnLongjs:true} option to return the actual Long.js object and preserve the entire 64 bits.

Links

  • http://cgit.freedesktop.org/dbus - freedesktop reference C library
  • https://github.com/guelfey/go.dbus
  • https://github.com/Shouqun/node-dbus - libdbus
  • https://github.com/Motorola-Mobility/node-dbus - libdbus
  • https://github.com/izaakschroeder/node-dbus - libdbus
  • https://github.com/agnat/node_libdbus
  • https://github.com/agnat/node_dbus - native js
  • https://github.com/cocagne/txdbus - native python + twisted
  • http://search.cpan.org/~danberr/Net-DBus-1.0.0/ (seems to be native, but requires libdbus?)
  • https://github.com/mvidner/ruby-dbus (native, sync)
  • http://www.ndesk.org/DBusSharp (C#/Mono)
  • https://github.com/lizenn/erlang-dbus/ - erlang
  • https://github.com/mspanc/dbux/ - elixir
  • http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html - Blog post about sb-bus and D-Bus in general