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 400,000 packages pre-installed, including voxel-json with all npm packages installed. Try it out:

var voxelJson = require("voxel-json")

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

voxel-json v0.0.0

capture player edits into json voxel diffs


capture player edits into json voxel diffs for voxeljs


var game = require('voxel-hello-world')();
var vjson = require('../')(game);

window.addEventListener('keydown', function (ev) {
    if (ev.which === 'Z'.charCodeAt(0)) {

Now press the z key in-game after making some edits. You'll get a JSON blob. You can then apply that JSON blob to make the same edits again elsewhere:



var voxelJSON = require('voxel-json')

var vjson = voxelJSON(game)

Register listeners on game and return a new vjson instance.


Apply a complete json object. json should have diff and later other parameters like terrain seed information.


Apply just a diff to the game.


Return a json object with the diff and terrain seed that can be sent to JSON.stringify().


With npm do:

npm install voxel-json

Compile for the browser with browserify.



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