save files from wget correctly

This commit is contained in:
b1ek 2023-03-17 16:24:05 +10:00
parent b41f37efa7
commit 33b23ec1ad
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ Usage: ${argv[0]} [URL] [-O out.file] [-V] [-Q] [-s]
if (filepath == '-') {
terminal.write(file);
} 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.onload = (e) => {
if (e.type == 'load') {
write(e.response);
write(req.response);
}
};
req.send();