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

screp-js

v0.3.0

Published

Pure Javascript version of screp, a StarCraft: Remastered replay file parser, compiled from the original Go version using GopherJS

Downloads

3

Readme

Apache 2.0 license npm version screp v1.7.2

screp-js

A pure Javascript version of screp, a StarCraft: Remastered replay file parser, compiled from the original Go version using GopherJS.

screp (StarCraft: Brood War Replay Parser) is a library for extracting information from StarCraft replay files. This library is based on a recompiled version of that library for Javascript. It's designed to parse file buffers of .rep files—if you want an easier interface aimed at parsing files through Node, try screp-js-file.

This wrapper is usable both as a CommonJS module and as a browser global.

Installation

This library can be installed through npm:

npm i --save screp-js

This library is about 367 KB gzipped (and 1,3 MB otherwise), as the compiled code generated by GopherJS is quite large.

Usage

The screp library can be either included in an HTML page, in which case it will be added to the global namespace as Screp, or it can be imported as a CommonJS module:

const Screp = require('screp-js')

const processRep(uint8arr) {
  try {
    // 'uint8arr' is a Uint8Array containing a .rep file.
    const res = await Screp.parseBuffer(uint8arr)
    return res
  }
  catch (err) {
    // If something went wrong, 'err' will be an Error object containing a string thrown by Go.
    console.log(err)
  }
}

Reference

Function:

Screp.parseBuffer(uint8arr[, {options}])

Parameters:

  • uint8arr Uint8Array
    the command to parse
  • options object (optional)
    a set of options used to change parsing behavior:
    • header boolean: true
      include replay header
    • computed boolean: true
      print computed/derived data
    • mapData boolean: false
      include map data
    • mapTiles boolean: false
      include map tiles; valid with mapData
    • mapResLoc boolean: false
      print map data resource locations (minerals and geysers); valid with mapData
    • cmds boolean: false
      print player commands

Returns:

  • Promise (object): the same data as you'd get from the screp command line tool

The defaults are the same as those for the screp command line tool.


Function:

Screp.getVersion()

Returns:

  • string: the same version information as you'd get from screp -version

Function:

Screp.getVersionObject()

Returns:

  • object: version information in object form, with only the pertinent information included

External links

Copyright

Apache License 2.0, as per the original screp project.