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

node-steam-shortcuts

v1.1.0

Published

Parse and build shortcuts.vdf files to manage Non-Steam Games in Valve's Steam-Client

Downloads

44

Readme

node-steam-shortcuts

Parse and build shortcuts.vdf files to manage Non-Steam Games in Valve's Steam-Client

Examples

Builder example

var Builder=require("node-steam-shortcuts").Builder;
var fs=require("fs");

var shortcuts=Builder.build([
  {
    appname: "A Non-Steam Game",
    exe: "C:\\Games\\NonSteamGame\\game.exe",
    StartDir: "C:\\Games\\NonSteamGame",
    tags: ["favorite","RPG","Dragons"]
  },
  {
    appname: "An other Non-Steam Game",
    exe: "C:\\Games\\NonSteamGame2\\game.exe",
    StartDir: "C:\\Games\\NonSteamGame2",
    tags: ["Racing","Arcade"]
  }
]);
fs.writeFile("shortcuts.vdf",shortcuts,function(err){
  if(err){
    return console.error("oops:",err);
  }
  console.log("done!");
});

Parser example

var fs=require("fs");
var Parser=require("node-steam-shortcuts").Parser;

//Let's read the file we wrote in the builder example
fs.readFile("shortcuts.vdf",function(err,shortcuts){
  if(err){
    return console.error("oops:",err);
  }
  shortcuts=Parser.parse(shortcuts).toJSON();
  console.log(shortcuts.length);  //2
  console.log(shortcuts[0].appname);  //"A Non-Steam Game"
  console.log(shortcuts[0].tags); //["favorite","RPG","Dragons"]
});

Documentation

Shortcut([properties])

Creates a new Shortcut-Object.

Arguments

  • properties
    • appname - A string. The name of the Non-Steam Game. Default "".
    • exe - A String. The absolute path to the executable of the Non-Steam Game. Default "".
    • StartDir - A string. The absolute path to the working directory for the Non-Steam Game. Usually the directory where the executable resides. Default "".
    • icon - A string. The absolute path to a file containing the icon for the Non-Steam Game. If empty, the icon of the executable will be used. Default "".
    • ShortcutPath - A string. Purpose unknown. Default "".
    • hidden - A boolean. Determines if the Non-Steam Game shall be hidden in the Client. Does not seem to work though. Default false.
    • tags - An array of strings. Contains the tags associated with the Non-Steam Game. Default [].
var Shortcut=require("node-steam-shortcuts").Shortcut;
var shortcut=new Shortcut({
  appname: "A Non-Steam Game",
  exe: "C:\\Games\\NonSteamGame\\game.exe",
  StartDir: "C:\\Games\\NonSteamGame",
  tags: ["favorite","RPG","Dragons"]
});

Properties

Additionally to the properties provided in the arguments, there is also:

  • favorite - A boolean. Indicates whether or not the Non-Steam Game is listed with the Favorites.
shortcut.appname="A fancier name";
shortcut.favorite=false;  //removes the tag "favorite" from the tags-array

Functions

addTags(tags)/addTag(tag)

Adds one ore more tags to the shortcut. Both functions are identical.

Arguments
  • tags: A string or an array of strings.

removeTags(tags)/removeTag(tag)

Removes one or more tags from the shortcut. Both functions are identical.

Arguments
  • tags: A string or an array of strings.

getSHA1()

Returns an SHA1-Hash of this shortcut. This value is only dependent on the exe property.

toJSON()

Returns a JSON-Object that describes the Shortcut-Object.

ShortcutCollection([shortcutCollection])

Creates a new ShortcutCollection-Object. A ShortcutCollection is a Set of Shortcuts. A ShortcutCollection can not contain two Shortcuts with the same SHA1-Hash.

Arguments

  • shortcutCollection - A Shortcut or an object describing a Shortcut or an array of Shortcutss and/or of objects describing Shortcuts.
var Shortcut=require("node-steam-shortcuts").Shortcut;
var ShortcutCollection=require("node-steam-shortcuts").ShortcutCollection;
var shortcut={
  appname: "A Game",
  exe: "C:\\Games\\NonSteamGame\\game.exe"
};
var shortcuts=new ShortcutCollection(shortcut);
//OR
shortcuts=new ShortcutCollection(new Shortcut(shortcut));
//OR
shortcuts=new ShortcutCollection([shortcut]);
//OR
shortcuts=new ShortcutCollection([new Shortcut(shortcut)]);

Functions

addShortcuts(shortcuts)/addShortcut(shortcut)

Adds one ore more shortcuts to the collection. Both functions are identical.

Arguments
  • shortcuts: A Shortcutor an object describing a Shortcut or an array of Shortcuts and/or of objects describing Shortcuts
toJSON()

Returns a JSON-Object that describes the ShortcutCollection-Object.