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-backup with all npm packages installed. Try it out:

var voxelBackup = require("voxel-backup")

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

voxel-backup v0.0.1

voxel-backup

Connect to a voxel-server and store the world chunks in level db

get it

on npm

npm install voxel-backup

defaults

var defaults = {
  worldName: 'world',
  server: 'ws://localhost:8000/',
}

if you dont specify a dbPath you'll get

opts.dbPath = __dirname+'/dump/'+opts.worldName

example

var backup = require('voxel-backup')

var options = {
  worldName: 'kumavis',
  server: 'ws://voxel.kumavis.me:8000/',
}

var backupper = backup(options, backupComplete, chunkComplete)

// ----- everything below this is optional -----

console.log('Using database "'+backupper.opts.dbPath+'"')
console.log('Using server "'+backupper.opts.server+'"')

function backupComplete(err) {
  if (err) throw err
  console.log('-- backup complete --')
  process.exit()
}

function chunkComplete(err, chunk) {
  if (err) throw err
  console.log( 'saved: '+chunk.position.join('|') )
}

backupper.on('chunk',function(encoded, chunk) {
  console.log( 'getting chunk: '+chunk.position.join('|') )
})

backupper.on('id', function(id) {
  console.log('got id', id)
})

Metadata

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