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

@yskomur/node-sdjournal

v0.5.0

Published

Native Node.js bindings for systemd sd-journal (read + write)

Readme

@yskomur/node-sdjournal

Native Node.js bindings for the systemd sd-journal API — read and write.

Built with pure NAPI (C), no C++ wrapper, ABI-stable across Node versions.

Features

| | | |---|---| | ✍️ Write | print(), send() (structured fields via sd_journal_sendv) | | 📖 Read | seekHead/Tail/Cursor/Time, getCursor, readEntry, readEntries | | 🔍 Filter | addMatch, setUnit, setIdentifier, setPriority, clearFilters | | 👀 Follow | reader.follow() with tail/head/current start modes | | 🟦 Types | Full TypeScript definitions (.d.ts) |

Requirements

  • Linux with systemd
  • libsystemd-dev (Debian/Ubuntu) or systemd-devel (Fedora/RHEL)
  • Node.js ≥ 18

Install

npm install @yskomur/node-sdjournal

Usage

Write

const { print, send, Priority } = require('@yskomur/node-sdjournal');

print(Priority.INFO, 'VM başlatıldı');

send({
  MESSAGE:           'VM started',
  PRIORITY:          String(Priority.INFO),
  SYSLOG_IDENTIFIER: 'myapp',
  VM_ID:             'vm-42',
});

Read

const { JournalReader, OpenFlags, Priority } = require('@yskomur/node-sdjournal');

const r = JournalReader.open(OpenFlags.LOCAL_ONLY);
r.setIdentifier('myapp');
r.setPriority(Priority.INFO);
r.seekTime(new Date(Date.now() - 5 * 60_000));

for (const entry of r.readEntries(50)) {
  console.log(`[${entry.timestamp.toISOString()}] ${entry.message}`);
}
r.close();

Follow (tail -f)

const ac = new AbortController();
process.on('SIGINT', () => ac.abort());

await r.follow(
  entry => console.log(entry.message, entry.cursor),
  { signal: ac.signal, start: 'tail' },
);

API

| Method | Description | |---|---| | print(priority, message) | sd_journal_print wrapper | | send(fields) | sd_journal_sendv — structured | | JournalReader.open(flags?) | Journal aç | | seekHead/Tail/Cursor/Time | Konumlan | | getCursor() | Mevcut cursor'ı al | | next() / previous() | İterate | | getEntry() | Entry oku → normalized { message, priority, fields, cursor, timestamp } | | readEntry() / readEntries(limit?) | High-level read helper | | addMatch(str) | Filter: "FIELD=value" | | setUnit / setIdentifier / setPriority | Common filter helper'ları | | clearFilters() | Tüm filter'ları temizle | | wait(usec?) | Yeni veri bekle | | follow(fn, opts?) | start: 'tail' | 'head' | 'current' ile takip |

Normalized Entry Shape

getEntry(), readEntry(), and readEntries() return:

{
  message: 'VM started',
  priority: 6,
  identifier: 'myapp',
  unit: 'myapp.service',
  cursor: 's=...',
  realtimeUsec: 1710000000000000,
  timestamp: new Date(),
  fields: {
    MESSAGE: 'VM started',
    PRIORITY: '6',
    SYSLOG_IDENTIFIER: 'myapp'
  }
}

Filter Helpers

const r = JournalReader.open();
r.setUnit('nginx.service');
r.setIdentifier('myapp');
r.setPriority(Priority.ERR);

These helpers use addMatch() internally, so multiple calls are combined as journal matches. Use clearFilters() to reset them.

Follow Start Modes

  • tail (default): seek to end and emit only newly appended entries
  • head: seek to beginning and stream forward from the oldest available entry
  • current: keep the current reader position and continue from there

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

Credits

Designed and written by Claude.ai (Anthropic) in collaboration with @yskomur.

Read API ergonomics, test updates, and documentation refresh contributions by Codex.

License

MIT