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

djay-connect

v2.0.1

Published

Library to read djay Pro's MediaLibrary.db and emit track change events

Readme

djay-connect

Library to read djay Pro's MediaLibrary.db and emit track change events. Supports djay Pro on macOS and Windows.

Installation

npm install djay-connect

Usage

import { DjayConnect } from 'djay-connect';

const djay = new DjayConnect({
  pollIntervalMs: 2000,
});

djay.on('ready', (info) => {
  console.log(`Watching: ${info.databasePath}`);
});

djay.on('track', (payload) => {
  const { track } = payload;
  console.log(`Now playing: ${track.artist} - ${track.title} [deck ${track.deckNumber}]`);
  if (track.filePath) console.log(`File: ${track.filePath}`);
  if (track.originSourceID) console.log(`Source: ${track.originSourceID}`);
});

djay.on('error', (err) => {
  console.error('Error:', err);
});

djay.start();

// Later...
djay.stop();

API

new DjayConnect(options?)

  • pollIntervalMs — Polling interval in milliseconds (minimum 2000, default 2000)
  • databasePath — Custom path to MediaLibrary.db. If omitted, uses the default per-platform path.
  • logger — Logger instance implementing { trace, debug, info, warn, error }

Track fields

Every track event carries a DjayNowPlayingTrack with:

  • title, artist, duration, deckNumber, startTime
  • uuid, sessionUUID — history entry and session identifiers
  • titleID — 32-hex id joining the track to location and analysis tables
  • originSourceID — where the track came from (explorer, music, beatport, soundcloud, spotify, tidal, beatsource, applemusic)
  • isrc — International Standard Recording Code (streaming tracks)
  • filePath — absolute path for local files, decoded from djay's URL-encoded file:// URIs
  • sourceURIs — raw source URIs; may contain multiple entries when a track is available on more than one streaming service

Events

  • ready — Emitted when monitoring starts
  • poll — Emitted on each poll cycle
  • track — Emitted when a new track is detected
  • error — Emitted on errors

Detection utilities

  • getDefaultDjayInstallPath() — Returns the default djay Pro data folder
  • getDefaultDatabasePath() — Returns the default MediaLibrary.db path for the current platform
  • getDefaultDatabasePaths() — Returns all candidate paths for the current platform
  • detectDjayInstallation() — Checks whether djay Pro is installed

Source helpers

  • DJAY_SOURCES — Catalog of every known originSourceID with kind, label, and URI scheme prefix
  • isStreamingSource(id) — True if the given source is a streaming service
  • toNowPlayingStreamingSource(id) — Maps a djay Pro source to the nowplaying streaming enum

TSAF parser (advanced)

  • parseHistorySessionItem(blob) — Parse a raw historySessionItems BLOB
  • extractTitleID(blob) — Extract the nested ADCMediaItemTitleID
  • extractSourceURIs(blob) — Extract all source URIs from a location blob
  • extractString, extractDouble, extractDate — Low-level field readers

See docs/FORMAT.md for the full on-disk format reference.

License

MIT