node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

hyperdrive-haus

hyperdrive-haus

A hyperdrive javascript API for dat.haus

NPM

var haus = require('hyperdrive-haus')
var archive = haus('archive-key-here')
 
archive.list(function (err, files) {
  console.log(files) // list of files 
})
 

API

var archive = haus(archive, opts)

archive: a hyperdrive archive or a hex encoded hyperdrive string. opts:

  • url: the URL for dat.haus, defaults to http://dat.haus

archive.createFileReadStream(entry)

Creates a read stream of the file with a given file name

Example:

var readStream = archive.createFileReadStream('hello.txt')
readStream.pipe(process.stdout)

archive.list(callback)

List the files in the archive. Takes an optional callback. Will return a stream if callback not supplied.

var stream = archive.list()
stream.on('data', function (entry) {
  console.log(entry)
})