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

@bawdo/blinkstick

v0.1.4

Published

Drive BlinkStick Nano and Square USB LEDs from the browser (WebHID) and Node (node-hid).

Readme

@bawdo/blinkstick

CI npm OpenSSF Scorecard codecov

Drive BlinkStick Nano and Square USB LEDs from the browser (WebHID) and from Node (node-hid).

This package is unofficial. It is not made by, or affiliated with, Agile Innovative, the makers of BlinkStick. See CAPABILITIES.md for what it supports.

Install

# Node (node-hid is an optional peer dependency)
npm i @bawdo/blinkstick node-hid

# Browser (Chrome or Edge, no node-hid)
npm i @bawdo/blinkstick

Node 22 or later. Import from @bawdo/blinkstick/node or @bawdo/blinkstick/webhid.

Quick start: Node

import { open } from "@bawdo/blinkstick/node";

const stick = await open();
try {
  await stick.setAll({ r: 255, g: 0, b: 0 });
  await stick.pulse({ r: 0, g: 255, b: 0 }, { duration: 1000, iterations: 2 });
} finally {
  await stick.close();
}

await using stick = await open(); also works on Node 24+ or in TypeScript.

Quick start: browser

Pair from a click, then open. Pairing persists, so later visits can skip pair().

import { open, pair, parseColor } from "@bawdo/blinkstick/webhid";

button.onclick = async () => {
  await pair();
  const stick = await open();
  await stick.blink(parseColor("orange"), { iterations: 3 });
  await stick.close();
};

Colours are { r, g, b }. parseColor takes hex, r,g,b or a CSS name.

More than one stick

import { list, open } from "@bawdo/blinkstick/node";

for (const info of await list()) console.log(info.serial, info.model);

const desk = await open({ serial: "BS072777-3.0" });

Give a stick a name once with setName("desk"), then open({ name: "desk" }). In the browser there are no serials, so names are how you tell sticks apart. list({ names: true }) adds each name, and marks sticks as busy when something else holds them or their name cannot be read.

Good to know

  • setInfoBlock, setName and setMode write the stick's EEPROM, which wears out. Call them rarely. Nothing else writes it.
  • After a mode write the stick refuses transfers while it stores the mode, so setMode waits for it to answer again (typically 12 to 15 ms, at most 250 ms) before it resolves.
  • macOS opens sticks exclusively. If another app (for example Chrome with the Blinky extension) holds a stick, open fails with "exclusive access".
  • npm 11 may warn that node-hid's install script was skipped. That is harmless: node-hid loads its shipped prebuild.
  • The types reference esnext.disposable (for await using), which adds the disposable globals to your type checking.
  • In the browser manufacturer is always "", because WebHID exposes no manufacturer string. Detection uses the product string and descriptor, so pass model: "nano" or "square" to open if a stick comes up unknown.
  • A Node stick with no serial cannot be reconnected.
  • On macOS a replugged stick occasionally fails to re-enumerate at the OS level. Replug it again.
  • In an MV3 service worker, open the stick, use it, and close it within the same event. Do not hold it open across events. Pair from a page, not the worker.
  • If a stick is unplugged, the next call reopens it and repaints the last colours. If it is still missing you get BlinkStickError with code DISCONNECTED.
  • Set stick.brightnessLimit (0 to 255) to cap brightness. A Square at full white draws about 500 mA.

Linux

Sticks are owned by root by default, so opening one needs a udev rule. Install the one shipped in the package:

sudo cp node_modules/@bawdo/blinkstick/udev/60-blinkstick.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger

Then unplug and replug the stick (or reboot). This grants access to whoever is logged in at the desktop (via systemd-logind's uaccess), so no group membership is needed. It covers the browser too.

Development

npm test               # unit tests, no hardware
npm run lint
npm run typecheck
npm run build
npm run test:hardware  # needs real sticks; never writes EEPROM
npm run test:browser   # local page for manual WebHID checks

Automated tests must never write EEPROM on a real stick.

Verifying a release

Every release from 0.1.1 has npm provenance, which npm audit signatures checks. Releases after 0.1.3 also carry GitHub build provenance. To check that a tarball came from this repository's release workflow, with the GitHub CLI:

npm pack @bawdo/[email protected]
gh attestation verify bawdo-blinkstick-0.1.4.tgz --repo bawdo/js-blinkstick \
  --signer-workflow bawdo/js-blinkstick/.github/workflows/release.yml

Swap in the version you are checking. SECURITY.md has the details.

Versioning

Releases follow semantic versioning. Until 1.0.0 the API may change between minor releases. See CHANGELOG.md.

Licence

MIT. See LICENSE.