joehand / dat-download

simple dat downloading module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

simple dat downloading module

License:MIT License


Languages

Language:JavaScript 100.0%