Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

binarykvparser

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binarykvparser

Parses binary KeyValues, used especially in Steam

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42K
decreased by-24.34%
Maintainers
1
Weekly downloads
 
Created
Source

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": []
	}
}
*/

Keywords

FAQs

Package last updated on 31 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc