Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1000 Bytes

README.md

File metadata and controls

38 lines (29 loc) · 1000 Bytes

request-download-info

This module is a wrapper around request module.

It provides progress event that shows current of the download like it's speed, ETA, percentage etc.

Installation

You have to install request module:

npm install request --save

Then you need to install this module:

npm install request-download-info --save

Usage

const request = require('request')
const RequestInfo = require('request-download-info')
const fs = require('fs')

let info = new RequestInfo(
  request('http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso')
)
info.on('progress', status => {
  console.log(status)
}).pipe(fs.createWriteStream('ubuntu.iso'))

The above example downloads Ubuntu iso from official page, to ubuntu.iso in current directory and prints status of download each second (by default).

Documentation

See Documentation here