node-curl-download

0.0.2 • Public • Published

Node.js Curl Downloader

Download any file without blocking your server using the power of curl.

forked from node-CurlDownloader and rewrited in coffee-script.

Download and install

Install through NPM

npm install curl-download

OR

Example usage in coffee

# import download 
Download = require 'download'
 
# new download instance 
dl = new Download(
  'http://code.jquery.com/jquery-1.11.0.min.js',
  'tmp/jquery-1.11.0.min.js'
  )
 
# when progress 
dl.on 'progress'(progress)->
  console.log "#{progress}%"
 
  return
 
# when end 
dl.on 'end'(code)->
  # when success 
  if code == 0
    console.log "finished successfully"
 
  # when fail 
  else
    console.log "finished unsuccessfully"
 
  process.exit(code)
 
  return
 
# start download 
dl.start()

Example usage in javascript

var Download, dl;
 
Download = require('download');
 
dl = new Download('http://code.jquery.com/jquery-1.11.0.min.js', 'tmp/jquery-1.11.0.min.js');
 
dl.on('progress', function(progress) {
  console.log("" + progress + "%");
});
 
dl.on('end', function(code) {
  if (code === 0) {
    console.log("finished successfully");
  } else {
    console.log("finished unsuccessfully");
  }
  process.exit(code);
});
 
dl.start();

Readme

Keywords

none

Package Sidebar

Install

npm i node-curl-download

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • hyspace