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

@tanislav000/bluez

v1.9.0

Published

Bluez5 D-Bus bindings for easy to use bluetooth access in Node.js

Readme

Bluez D-Bus

Easy to use Node.js Bluez5 D-Bus library.

Install

npm install bluez

Usage

const Bluez = require('bluez');

// Initialize bluetooth interface
const bluetooth = new Bluez();
await bluetooth.init();

// listen on first bluetooth adapter
const adapter = await bluetooth.getAdapter();
// Register callback for new devices
adapter.on('DeviceAdded', (address, props) => {
    console.log("Found new Device " + address + " " + props.Name);
});
await adapter.StartDiscovery();
console.log("Discovering");

Custom Agents and Profiles can be implemented by extending Agent / Profile base classes. Then use bluez.registerAgent(agent, capability) and bluez.registerProfile(profile, options) to activate them.

Examples

Have a look at the examples or tests for more detailed usage information.

API Docs

The API is based mostly on Bluez's DBus interface. Its documentation can be found in its repository.

Additionally this library provides some convenience functions which can be found in API.md.

There is also low level access to the underlying Dbus interfaces available. Please have a look at dbus.md.

Tested with

  • Node.js 12 and 14
  • Bluez 5.50 Ubuntu 18.04
  • Bluez 5.53 Ubuntu 20.04
  • Bluez 5.48 Debian Stretch
  • Bluez 5.50 Debian Buster
  • Bluez 5.54 Debian Sid

Older Bluez version should work, but might miss some functions. However I can not recommend using GATT with Bluez < 5.48.

Migration

0.4.x -> 1.0

  • Underling Dbus library was replaced by dbus-next. If you depend on the old library, do not update.
  • bluetooth-socket is no longer a required dependency, if your project depends on it install it directly.
  • Device.getService() was renamed to Device.getGattService()
  • Bluez.getDevice() was moved to Adapter.getDevice()
  • Bluez.getAllDevicesProps() was moved to Adapter.listDevices()
  • Bluez.on("device") was moved to Adapter.on("DeviceAdded")
  • Bluez.registerStaticKeyAgent() was replaced by Bluez.registerAgent(new SimpleAgent(pin))
  • Bluez.registerSerialProfile() was removed. See example/serial.js for new usage

0.3.x -> 0.4

  • Characteristic Values are now always Buffers
  • Characteristic, Descriptor and Service properties where changed to functions
  • RawFdSocket was removed and replaced by bluetooth-socket module
  • Bluez.registerDummyAgent was renamed to Bluez.registerStaticKeyAgent which takes a pin code as argument
  • Bluez.getAllDevicesAddresses was renamed to Bluez.getAllDevicesProps which returns all properties not only the address.