node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

hyperdrive-checkout

hyperdrive-checkout

checkout previous snapshots of files in a hyperdrive

example

var hyperdrive = require('hyperdrive')
var namedArchives = require('hyperdrive-named-archives')
var level = require('level')
var checkout = require('hyperdrive-checkout')
 
var named = namedArchives({
  drive: hyperdrive(level('/tmp/drive.db')),
  db: level('/tmp/db')
})
var archive = named.createArchive('whatever')
 
var block = Number(process.argv[2])
var c = checkout(archive, block)
 
if (process.argv[3] === 'list') {
  c.list({ live: false }, function (err, files) {
    console.log(files)
  })
} else if (process.argv[3] === 'show') {
  var name = process.argv[4]
  c.createFileReadStream(name).pipe(process.stdout)
}

api

var checkout = require('hyperdrive-checkout')

var c = checkout(archive, block)

Return a cursor c for the archive at block.

The cursor c has a read-only subset of the hyperdrive archive API.

install

npm install hyperdrive-checkout

license

BSD