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

@ckoenig1/slippi-js

v6.1.1

Published

Official Project Slippi Javascript SDK

Downloads

117

Readme

slippi-js

npm version Build Status Coverage Status License

This is the official Project Slippi Javascript SDK. It provides tools for parsing .slp files into structured data and can be used to compute stats. There are already many built-in stats that are computed by the library but the data provided can also be used to compute your own stats.

Installation

With NPM

npm install @slippi/slippi-js

With Yarn

yarn add @slippi/slippi-js

Writing a simple script

  1. Create a fresh directory on your disk
  2. Inside this new directory, create a file called script.js
  3. Fill the script.js file with the following contents:
const { SlippiGame } = require("@slippi/slippi-js");

const game = new SlippiGame("test.slp");

// Get game settings – stage, characters, etc
const settings = game.getSettings();
console.log(settings);

// Get metadata - start time, platform played on, etc
const metadata = game.getMetadata();
console.log(metadata);

// Get computed stats - openings / kill, conversions, etc
const stats = game.getStats();
console.log(stats);

// Get frames – animation state, inputs, etc
// This is used to compute your own stats or get more frame-specific info (advanced)
const frames = game.getFrames();
console.log(frames[0].players); // Print frame when timer starts counting down
  1. Copy a .slp file into the directory and call it test.slp
  2. Browse to the directory from the command line and run the command: npm install @slippi/slippi-js. This should create a node_modules directory in the folder.
  3. Run the command: node script.js. This will run the script above and will print data about the test.slp file

Reading live files

When using Slippi to mirror gameplay, it can be useful to extract game data about the live game. There are a few different methods of doing this but slippi-js can also be used to read live files. It is written in such a way where as long as the same SlippiGame class is used, it will only read from disk the data it has not yet read.

One thing to note, when creating the SlippiGame object, be sure to enable processOnTheFly to get updated stats as the game progresses.

const game = new SlippiGame("path/to/your/slp/file", { processOnTheFly: true });

An example script for how to do this is provided as part of this repo here: https://github.com/project-slippi/slippi-js/blob/master/scripts/realtimeFileReads.js

To use the above script, do the following:

  1. Open a terminal prompt in the folder containing the script file and the package.json file
  2. Run yarn to fetch the dependencies
  3. Run node realtimeFileReads.js "C:\mirror\output\path" replacing the path argument with where your connected console outputs replay files to

At this point, you should see an output as you play games on the connected console.

Development

Setup

git clone https://github.com/project-slippi/slippi-js
cd slippi-js
yarn install

Build

yarn run build

You can also run yarn run watch to continuously build whenever changes are detected.

Test

yarn run test