Put files from urls into dat
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
example.js
index.js
package.json
readme.md
test.js

readme.md

Urls to Dat

Put files from urls into a hyperdrive archive

See other modules for more info:

  • tar-dat: streams tarball into dat
  • url-tar: puts body from url into tar

Usage

urlDat(urls, archive, cb)

var hyperdrive = require('hyperdrive')
var swarm = require('hyperdrive-archive-swarm')
var memdb = require('memdb')
var urlDat = require('url-dat')

var drive = hyperdrive(memdb())
var archive = drive.createArchive()

var urls = ['http://google.com', 'http://npmjs.com']

urlDat(urls, archive, function (err) {
  if (err) throw err
  archive.finalize(function (err) { 
    if (err) throw err
    console.log('sharing key: ', archive.key.toString('hex'))
    swarm(archive)
  })
})