Skip to content

Instantly share code, notes, and snippets.

View varshneyjayant's full-sized avatar

Jayant Varshney varshneyjayant

View GitHub Profile
@varshneyjayant
varshneyjayant / download.js
Created November 25, 2016 12:52 — forked from falkolab/download.js
Download file by http with progress (NodeJS)
function download(fileUrl, apiPath, callback) {
var url = require('url'),
http = require('http'),
p = url.parse(fileUrl),
timeout = 10000;
var file = fs.createWriteStream(apiPath);
var timeout_wrapper = function( req ) {
return function() {