save files from wget correctly
This commit is contained in:
parent
b41f37efa7
commit
33b23ec1ad
|
@ -41,7 +41,7 @@ Usage: ${argv[0]} [URL] [-O out.file] [-V] [-Q] [-s]
|
||||||
if (filepath == '-') {
|
if (filepath == '-') {
|
||||||
terminal.write(file);
|
terminal.write(file);
|
||||||
} else {
|
} else {
|
||||||
fs.writeFileSync(filepath, file);
|
fs.writeFileSync(filepath, new Buffer(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Usage: ${argv[0]} [URL] [-O out.file] [-V] [-Q] [-s]
|
||||||
req.onprogress = progress;
|
req.onprogress = progress;
|
||||||
req.onload = (e) => {
|
req.onload = (e) => {
|
||||||
if (e.type == 'load') {
|
if (e.type == 'load') {
|
||||||
write(e.response);
|
write(req.response);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
req.send();
|
req.send();
|
||||||
|
|
Loading…
Reference in New Issue