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 🙏

© 2024 – Pkg Stats / Ryan Hefner

screparsed

v0.0.5

Published

A StarCraft: Remastered replay parser, taking much inspiration from [screp](https://github.com/icza/screp) (a golang implementation).

Downloads

3

Readme

screparsed

A StarCraft: Remastered replay parser, taking much inspiration from screp (a golang implementation).

It works both via NodeJS and in the browser (browser app demonstration included).

Installation

npm i screparsed --save

Usage in browser

This package should work out-of-the-box for NodeJS environments. In the browser, you'll need polyfills for zlib, buffer, stream, util, and assert. See vite.config.ts for an example configuration.

Examples

Constructing via file in NodeJS

const file = await open(replay, O_RDONLY);
const readStream = file.createReadStream();
const parser = ReplayParser.fromReadableStream(
  new ReadableStream({
    start(controller) {
      readStream.on("data", (chunk) => {
        controller.enqueue(chunk);
      });
      readStream.on("end", () => {
        controller.close();
      });
      readStream.on("error", (err) => {
        controller.error(err);
      });
    },
    type: "bytes",
  });
);

Constructing via ArrayBuffer (e.g., after fetch in browser)

const parser = ReplayParser.fromArrayBuffer(arrayBuffer);

Parse

const parsed = await parser.parse();

Print game info, players (colors, race, name, apm, eapm), and chat messages

console.log(JSON.stringify({
    gameInfo: parsed.gameInfo,
    players: parsed.players,
    messages: parsed.chatMessages.map((message) => `${message.sender.name}: ${message.message}`),
}, null, 2));

Displays

{
  "gameInfo": {
    "engine": 1,
    "frames": 15710,
    "startTime": "2023-08-08T03:19:03.000Z",
    "title": "aIcA^O_vNgMw",
    "mapWidth": 128,
    "mapHeight": 128,
    "availableSlotsCount": 2,
    "speed": 6,
    "type": 15,
    "subType": 1,
    "host": "[dex]",
    "map": "\u0007Polyp\u0006oid \u00061\u0003.65"
  },
  "players": [
    {
      "slotID": 0,
      "ID": 0,
      "type": 2,
      "race": "zerg",
      "team": 1,
      "name": "[dex]",
      "color": {
        "name": "Brown",
        "rgb": 7352340
      },
      "apm": 430,
      "eapm": 258
    },
    {
      "slotID": 2,
      "ID": 1,
      "type": 2,
      "race": "terran",
      "team": 2,
      "name": "some1",
      "color": {
        "name": "Blue",
        "rgb": 805068
      },
      "apm": 332,
      "eapm": 264
    }
  ],
  "messages": [
    "[dex]: gg"
  ]
}

Running via CLI

# in repo directory
npm i
npm run cli -- /path/to/replay.rep

Running drag-n-drop web preview locally

# in repo directory
npm build
cd web-preview
npm i
npm run dev