Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including schemapack with all npm packages installed. Try it out:

const sp = require('schemapack'); // Define the schema const playerSchema ={ health: 'varuint', jumping: 'boolean', position: [ 'int16' ], attributes: { str: 'uint8', agi: 'uint8', int: 'uint8' }, }); // An object to serialize const player = { health: 4000, jumping: false, position: [ -540, 343, 1201 ], attributes: { str: 87, agi: 42, int: 22 }, }; // Encode const buffer = playerSchema.encode(player); console.log(buffer); // Decode const decoded = playerSchema.decode(buffer); console.log(decoded);

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

schemapack v1.4.2

The fastest and smallest JavaScript object serialization library. Efficiently encode your objects in to compact byte buffers and then decode them back in to objects on the receiver. Integrates very well with WebSockets.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free