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

binarykvparser

v2.2.0

Published

Parses binary KeyValues, used especially in Steam

Downloads

214,141

Readme

BinaryKVParser

This lightweight module parses Binary KeyValues, which is a Valve-proprietary format used in Steam.

This is not the same as VDF aka KeyValues. To parse that, use the vdf module.

Usage

require('binarykvparser') returns the BinaryKVParser namespace, which contains two methods:

parse(buffer[, offset])

  • buffer - Either a Buffer or a ByteBuffer to decode
  • offset - Optional. The offset where the parser should start reading. Default 0 (to start at the beginning of the buffer). No ending position required, as it will stop automatically once it reaches the end of the message (which may or may not be the end of the buffer)

getByteLength(buffer[, offset])

  • buffer - Either a Buffer or a ByteBuffer to decode
  • offset - Optional. The offset where the parser should start reading. Default 0 (to start at the beginning of the buffer). No ending position required, as it will stop automatically once it reaches the end of the message (which may or may not be the end of the buffer)

v2.2.0 or later is required to use this method

Returns the length in bytes of the BinaryKV object contained in the given Buffer.

Example

var BinaryKVParser = require('binarykvparser');
var msg = new Buffer('0100000000353430323900027061636b6167656964000dd300000262696c6c696e67747970650001000000026c6963656e736574797065000100000002737461747573000000000000657874656e6465640001616c6c6f7763726f7373726567696f6e74726164696e67616e6467696674696e670066616c736500080061707069647300023000da020000023100e4020000023200e902000008006465706f7469647300023000db020000023100dc020000023200dd020000023300de02000008006170706974656d7300080808', 'hex');
console.log(BinaryKVParser.parse(msg));

/*
{
	"54029": {
		"packageid": 54029,
		"billingtype": 1,
		"licensetype": 1,
		"status": 0,
		"extended": {
			"allowcrossregiontradingandgifting": "false"
		},
		"appids": [
			730,
			740,
			745
		],
		"depotids": [
			731,
			732,
			733,
			734
		],
		"appitems": []
	}
}
*/