Add sh.wget() for downloading files into the fs, with tests and docs

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-25 11:47:08 -04:00
parent 1b12f44a02
commit 0e213077e7
2 changed files with 2 additions and 0 deletions

View File

@ -1343,6 +1343,7 @@ sh.mkdirp('/test/mkdirp', function(err) {
#### sh.wget(url, [options], callback)<a name="wget"></a> #### sh.wget(url, [options], callback)<a name="wget"></a>
Downloads the file at `url` and saves it to the filesystem. Downloads the file at `url` and saves it to the filesystem.
The file is saved to a file named with the filename portion of the url The file is saved to a file named with the filename portion of the url
unless the `options.filename` is present, in which case that unless the `options.filename` is present, in which case that
filename is used instead. The callback receives `(error, path)`, filename is used instead. The callback receives `(error, path)`,

View File

@ -471,6 +471,7 @@ define(function(require) {
if("withCredentials" in request) { if("withCredentials" in request) {
request.withCredentials = true; request.withCredentials = true;
} }
request.responseType = "arraybuffer"; request.responseType = "arraybuffer";
request.send(); request.send();
}; };