Im using the following code to download a zip file. If you put the URL into a browser you will see that it starts downloading. But when I use Node to download the zip, the output test.zip file contains this:
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://patentscdn.reedtech.com/ipg150804-zip/ipg150804.zip?sv=2014-02-14&sr=b&sig=u1W37AFnH9DAcqc7k4tDABaV14eSlchN8fJJ1%2FOkWEo%3D&st=2015-08-04T04%3A00%3A00Z&se=9999-12-31T05%3A00%3A00Z&sp=r">here</a></body>
Heres the Node.js code:
var http = require('http');
var fs = require('fs');
var url = 'http://patents.reedtech.com/downloads/GrantRedBookText/2015/ipg150804.zip';
http.get(url, function(response) {
response.on('data', function(data) {
fs.appendFileSync('test.zip', data);
});
response.on('end', function() {
console.log('hello');
});
});