dat-download

1.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i dat-download

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jhand