1.0.1 • Published 7 years ago

dat-download v1.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

dat-download

One-time file downloads via Dat. Download a single file or subdirectory from a dat. Automatically joins the network and handles everything for you.

npm travis standard

Example

var datDownload = require('dat-download')

datDownload('dat://778f8d955175c92e4ced5e4f5563f69bfec0c86cc6f670352c457943666fe639/dat.json', process.cwd(), function (err) {
    if (err) throw err
    console.log('done downloading! thanks')
})

Works with DNS-type dat keys too!

var datDownload = require('dat-download')

datDownload('dat://beakerbrowser.com/index.html', process.cwd(), function (err) {
    if (err) throw err
    console.log('done downloading! thanks')
})

Can also download a whole dat:

var datDownload = require('dat-download')

datDownload('dat://beakerbrowser.com/', process.cwd(), function (err) {
    if (err) throw err
    console.log('done downloading! thanks')
})

Install

npm install dat-download

API

datDownload(datPath, [destination], callback)

  • datPath - dat key with subdirectory or file path. If the whole key is specified, it will download to destination/key.
  • destination - download folder

License

MIT