node-csgo icon indicating copy to clipboard operation
node-csgo copied to clipboard

TypeError: buffer.readCString is not a function

Open dennyb opened this issue 3 years ago • 1 comments

Happens I guess during requestGame infos.

/node_modules/csgo/helpers/VDF.js:28
            var name = buffer.readCString();
                              ^

TypeError: buffer.readCString is not a function
    at Object.exports.decode (/node_modules/csgo/helpers/VDF.js:28:31)
    at CSGOClient.handlers.<computed> (/node_modules/csgo/handlers/rich_presence.js:44:20)
    at SteamClient.<anonymous> (/node_modules/csgo/index.js:50:30)
    at SteamClient.emit (events.js:326:22)
    at SteamClient._netMsgReceived (/node_modules/steam/lib/steam_client.js:175:10)
    at SteamClient.handlers.<computed> (/node_modules/steam/lib/steam_client.js:262:10)
    at SteamClient._netMsgReceived (/node_modules/steam/lib/steam_client.js:160:26)
    at Connection.emit (events.js:314:20)
    at Connection._readPacket (/node_modules/steam/lib/connection.js:50:8)
    at Connection.emit (events.js:314:20)

dennyb avatar Feb 04 '22 23:02 dennyb

Looks like changing this line: https://github.com/joshuaferrara/node-csgo/blob/master/helpers/VDF.js#L18

from if(typeof(buffer.readUint8) != "function"){ to if(typeof(buffer.readCString) != "function"){

It correctly wraps the buffer and fixes it.

dabbers avatar May 23 '23 01:05 dabbers