README
csgo-sharecode
Node module to decode / encode the CSGO share codes used to share game replays between players.
Installation
npm i csgo-sharecode
or yarn add csgo-sharecode
Since the version 2, this module relies on native BigInt which is available since Node 10.8.0. For Node < 10.8.0, please use the version 1.
Usage
Decode
Decode a share code from its string to an object.
const { decode } = require('csgo-sharecode');
const shareCode = 'CSGO-GADqf-jjyJ8-cSP2r-smZRo-TO2xK';
const info = decode(shareCode);
console.log(info);
// output:
// {
// matchId: 3230642215713767580n,
// reservationId: 3230647599455273103n,
// tvPort: 55788
// }
Encode
Encode a CDataGCCStrike15_v2_MatchInfo (lookup for CDataGCCStrike15_v2_MatchInfo
) message into a share code (string).
The object match
used in the example below use values coming from a real CDataGCCStrike15_v2_MatchInfo message.
You should get it from the Steam Game Coordinator or from a .info file.
const { encode } = require('csgo-sharecode');
const match = {
matchId: BigInt('3230642215713767580'),
reservationId: BigInt('3230647599455273103'),
tvPort: 599906796,
};
const shareCode = encode(match.matchId, match.reservationId, match.tvPort);
console.log(shareCode);
// output: "CSGO-GADqf-jjyJ8-cSP2r-smZRo-TO2xK"