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

rosbag-rx

v0.0.3

Published

**A high-performance, frontend-focused ROS bag playback library for JavaScript and TypeScript.**

Readme

rosbag-rx

A high-performance, frontend-focused ROS bag playback library for JavaScript and TypeScript.


🚀 Install

npm install rosbag-rx

🎯 Purpose

rosbag-rx brings the simplicity of rosbag play to the browser and modern frontend environments.

It removes the need to manually handle .bag file parsing, message decoding, or timing synchronization — allowing you to focus on building robotics tools instead of reinventing playback logic.

With just a few lines of code, you can load a .bag file, extract metadata, and stream messages efficiently in real time — with zero playback delay.

📦 Features

  • 🎯 Simulates rosbag play in browser/JavaScript
  • 🕒 Real-time playback with accurate timing
  • 🔁 play(), pause(), seek() and looping support
  • ⚡ Zero-delay streaming via RxJS observables
  • 🧠 Automatic memory and subscription management
  • 🔌 Easily toggle topic streams
  • 🧹 Built-in cleanup mechanism

🧪 Advanced Usage (RosbagManager)

The RosbagManager class is the main interface for high-level bag playback. It handles state management, playback, message streaming, and cleanup — all through a clean RxJS-based API.

You can reuse the same RosbagManager instance for multiple files. It will automatically reset internal state when a new file is loaded.


🧱 Initialize

import { RosbagManager } from "rosbag-rx";

const rosbagManager = new RosbagManager();

📡 Subscribe to Bag State

You should subscribe to state$ before calling loadFile().

This stream includes bag metadata, playback state, and current playback time. No need to manually unsubscribe — everything is cleaned up automatically when destroyInstance() is called.

rosbagManager.state$.subscribe({
  next: (state) => {
    console.log(state);
    // {
    //   currentTime: { sec, nsec },
    //   bagMetadata: {
    //     startTime: { sec, nsec },
    //     endTime: { sec, nsec },
    //     connections: Map(...),
    //     chunksInfo: [...]
    //   },
    //   options: {
    //     prefetch: 10,
    //     playbackSpeed: 1,
    //     loop: true
    //   },
    //   isPlaying: false
    // }
  },
});

⚠️ Handle Errors

You can subscribe to error$ to receive well-explained errors such as:

  • Corrupted bag file
  • Parsing issues
  • Unsupported or malformed message structures
rosbagManager.error$.subscribe({
  next: (error) => {
    console.error("Bag error:", error);
  },
});

📨 Subscribe to Streamed Messages

You will receive an array of messages for the currently active time slice, filtered by the topics you’ve toggled using showConnectionMsgs.

rosbagManager.messages$.subscribe({
  next: (messages) => {
    console.log("Received messages:", messages);
  },
});

📂 Load and Control Playback

rosbagManager.loadFile(file);

rosbagManager.play();
rosbagManager.pause();
rosbagManager.seek({ sec: 0, nsec: 0 }); // Seek to start

⚙️ Update Playback Options

rosbagManager.updateOptions({
  playbackSpeed: 5, // Default is 1
  prefetch: 1, // Default is 10 seconds (recommended)
  loop: false, // Default is true
});

🎛️ Toggle Topic Streams

By default, all topics are disabled. To receive messages, you must explicitly enable them.

Show a topic:

rosbagManager.showConnectionMsgs("/odom");

Hide a topic:

rosbagManager.hideConnectionMsgs("/odom");

🧹 Clean Up

To prevent memory leaks and stop all internal observables, call:

rosbagManager.destroyInstance();

This will:

  • Unsubscribe from all internal streams
  • Reset internal state
  • Release all resources