Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Downloading a file #56

Open
SantoshSrinivas79 opened this issue Mar 16, 2017 · 0 comments
Open

Downloading a file #56

SantoshSrinivas79 opened this issue Mar 16, 2017 · 0 comments

Comments

@SantoshSrinivas79
Copy link

The script works but the zip file is corrupted. What am I doing wrong here?

// curl -LOk  -X 'GET' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0' -H 'Referer: https://nseindia.com/products/content/equities/equities/archieve_eq.htm' -H 'Upgrade-Insecure-Requests: 1' 'https://nseindia.com/content/historical/EQUITIES/2000/MAR/cm7MAR2000bhav.csv.zip'


var curl = require('curlrequest');
var fs   = require( 'fs' );

var options = {
    url: 'https://nseindia.com/content/historical/EQUITIES/2000/MAR/cm7MAR2000bhav.csv.zip',
    verbose: true,
  	headers: { 
  		'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0',
  		'Referer': 'https://nseindia.com/products/content/equities/equities/archieve_eq.htm',
  		'Upgrade-Insecure-Requests': '1'	
  	}
};

var file = fs.createWriteStream("bhav.zip");

curl.request(options, function (err, data) {
    file.write(data);
});
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant