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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ndbus

v0.0.1

Published

A NodeJS D-Bus interface

Readme

Overview

This is a DBus integration addon for NodeJS. It developed for performance and stability, ease of using and supporting.

It uses a libdbus only and doesn't depends from other libraries, like GLib and etc.

Why?

When I needed to use DBus in my projects, I tried to use all found DBus modules, but nothing of it worked properly for me.

  • DBus addon by Shogun has strange and inconvenient API. Asynchronous operations fails to work for me. Also I cannot receive signals and implement service method calls. In early stage I tries to fix that behavior, but internal implementation looks like too tricky to support it.

  • DBus addon by Motorola-Mobility is too low-level implementation, in fact it's almost a libdbus bindings. So high-level wrapper required to make it more convenient and easy for use. I tried to launch with it, but I don't agree what stuff like manipulating with DBus messages on JS-side is a good idea.

  • Native implementation by Sidorares works more properly, but it have some serious problems with introspection and marshaling.

    Of course, using native implementation also is a not good idea for performance reasons.

How?

Internally this addon uses libuv for handling incoming data, so all interaction occurs in same thread with node and v8.

Installation

#!shell

$ npm install ndbus

Usage

#!javascript

var DBus = require('ndbus');
...

var session_bus = DBus();
var system_bus = DBus(true);
var custom_bus = DBus("custom_bus_name");

High-Level API

Interfacing with proxies

Objects must be introspectable to be able interact with its through proxies.

#!javascript

// binding object through proxy
bus.proxy("org.awesome.Service", "/path/to/object", "org.awesome.Interface",
function(err, some_object){
  // we need to handle errors
  ...
  // calling method of proxied object
  some_object.SomeMethod(arg0, arg1, ..., argN, function(err, ret0, ret1, ..., retN){
    // we need to handle errors
    ...
  });
  // binding to signal of proxied object
  function someListener(arg0, arg1, ..., argN){
    ...
  }
  some_object.SomeSignal.on(someListener);
  // unbinding from signal of proxied object
  some_object.SomeSignal.off(someListener);
  // binding to signal of proxied object only for one time
  some_object.SomeSignal.once(someListener);
  ...
  // removing proxy
  some_object.$();
});

Creating services

To create service you need to provide specification in simplified JSON-like format.

#!javascript

// creating service on the bus
bus.service("org.awesome.Service", function(err, some_service){
  // we need to handle errors
  ...
  // creating node with callback
  some_service.node("/path/to/object", function(err, node){
    // providing interface with callback
    node.iface("org.awesome.Interface", {
      // interface specification
      method: {
        // methods
        SomeMethod: {
          arg: {
            // in arguments
            arg0Name: arg0Signature,
            arg1Name: arg1Signature,
            ...
            argNName: argNSignature
          },
          res: {
            // out arguments
          }
        },
        AnotherMethod: {
          arg: [ arg0Signature, arg1Signature, ..., argNSignature ],
          $: {
            // method annotations
            annotationName: annotationValue
          }
        }
      },
       signal: {
        // signals
        someSignal: {
          arg: {
            // signal arguments
          },
          $: {
            // signal annotations
          }
        }
      },
      attrib: {
        // attributes (properties)
      },
      $: {
        // interface annotations
      }
    }, function(err, iface){
      // we need to handle errors
      ...
      // implementing method
      iface.SomeMethod(function(arg0, arg1, ..., argN, result){
        ...
        // emiting signal
        iface.SomeSignal(arg0, arg1, ..., argN);
      });
    });
    // providing interface with callback and object
    node.iface("org.awesome.Interface", {
      // interface specification
      ...
    }, {
      SomeMethod: function(arg0, arg1, ..., argN, result){
         ...
        // emiting signal
        this.SomeSignal(arg0, arg1, ..., argN);
      }
    }, function(err, iface){
      // we need to handle errors
      ...
      // removing interface
      iface.$();
    });
    ...
    // deleting node
    node.$();
  });
  ...
  // deleting service
  service.$();
});

Low-Level API

You need to use this only for extending High-Level API and in some special cases.

#!javascript

var nDBus = require('ndbus').internal;
...
var some_connection = nDBus.Connection(); // like DBus()
var some_interface = nDBus.Interface(some_connection); // like bus.proxy()
var some_method = nDBus.Method(some_interface, "MethodName", "in signature", "out signature");
var some_signal = nDBus.Signal(some_interface, "SignalName", "signature");
...
// call method
some_method.call([arg0, arg1, ..., argN], function(err, returns){
  var ret0 = returns[0], ret1 = returns[1], ..., retN = returns[N];
  ...
});
// register method callback
some_method.reg(function(args, result){
  var arg0 = args[0], arg1 = args[1], ..., argN = args[N];
  ...
  // asynchronous return case
  result([ret0, ret1, ..., retN]);
  // synchronous return case
  return [ret0, ret1, ];
});
// get registered method callback
var callback = some_method.reg();
// unregister method callback
some_method.reg(null);
...
// emit signal
some_signal.emit([arg0, arg1, ..., argN]);
// register signal listener
some_signal.reg(function(args){
  var arg0 = args[0], arg1 = args[1], ..., argN = args[N];
  ...
});
// get registered signal listener
var listener = some_signal.reg();
// unregister signal listener
some_signal.reg(null);

Licensing

This addon are available under GNU General Public License version 3.

ndbus — DBus integration addon for NodeJS.

Copyright © 2013 Kayo Phoenix [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.