npm.io
0.0.2 • Published 10 years agoCLI

dwn

Licence
—
Version
0.0.2
Deps
5
Vulns
1
Weekly
0

dwn

A simple tool for downloading via node.js

Base code partly copied from hughsk/nw-download

Command Line

$ npm install -g dwn
$ dwn http://example.com/logo.png
$ dwn http://example.com/logo.png cache/
$ dwn http://example.com/logo.png cache/boy.png

Nodejs Library

var dwn = require('dwn')
dwn({
  uri: 'http://example.com/logo.png',  // required
  progress: function(v){},  // eg. 15%, v=0.15
  callback: function(err, buf){}  // buffer
})

or with stream:

var stream = dwn._download(uri)
stream.on('progress', function(v){
  console.log('progress:', v)
})
stream.on('end', done)
stream.on('error', done)
stream.pipe(createWriteStream(dest))

Keywords