mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -04:00
check the status code when downloading the vanilla server
This commit is contained in:
parent
3a2fca87b9
commit
a2bb6c1d39
@ -2,7 +2,11 @@ var https = require('https');
|
||||
var fs = require('fs');
|
||||
var version = require("./src/version");
|
||||
|
||||
var file = fs.createWriteStream(process.argv[2]);
|
||||
var request = https.get("https://s3.amazonaws.com/Minecraft.Download/versions/"+version.minecraftVersion+"/minecraft_server."+version.minecraftVersion+".jar", function(response) {
|
||||
response.pipe(file);
|
||||
if(response.statusCode==200) {
|
||||
var file = fs.createWriteStream(process.argv[2]);
|
||||
response.pipe(file);
|
||||
}
|
||||
else
|
||||
process.exit(1);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user