node-pogo-protos
Uses protobuf.js to compile the Protobuf files from POGOProtos into an easy to use Node module.
Contains a workaround that fixes the proto3 packed fields bug in protobuf.js for you.
How to use
const POGOProtos = ; var myMessage = item_id: POGOProtosInventoryItemItemIdITEM_POTION count: 50; var encoded = myMessage; var decodedAgain = POGOProtosNetworkingRequestsMessagesRecycleInventoryItemMessage;console; // will print 50
For more details see the protobuf.js documentation.
Usage with TypeScript
TypeScript definitions are included. To use them, make sure that:
- Typings is installed:
npm install -g typings
(create an alias fortypings
if installed locally) - External type declarations have been added:
typings install dt~long dt~bytebuffer env~node --global --save
Add declarations to .tsconfig.json
:
/* ... */ "files": "typings/index.d.ts" /* ... */ /* ... */
And use import
instead of require
:
;
TypeScript 2.0 module resolution via @types
is not currently supported, however the above will work for both TypeScript ^1.8 and ^2.0.