forked from Inrixia/Floatplane-Downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
INSANITY\Inrix
authored and
INSANITY\Inrix
committed
Jan 18, 2018
1 parent
f140ab3
commit a601929
Showing
17 changed files
with
248 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CMD /C npm install request fs adm-zip --save | ||
node install.js | ||
CMD /C npm update | ||
CMD /C npm update | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const request = require('request') | ||
const fs = require('fs') | ||
const AdmZip = require('adm-zip') | ||
|
||
getInstall().then(moveFiles).then(deleteFiles) | ||
|
||
function getInstall() { | ||
return new Promise((resolve, reject) => { | ||
request.get({ | ||
url: 'https://raw.githubusercontent.com/Inrixia/Floatplane-Downloader/master/latest.json', | ||
}, function (err, resp, body) { | ||
updateInfo = JSON.parse(body) | ||
console.log('Now Installing Version: '+updateInfo.version+'\n\n') | ||
request('https://raw.githubusercontent.com/Inrixia/Floatplane-Downloader/master/releases/'+updateInfo.version+'.zip').on('error', function (err) { | ||
console.log(err); | ||
}).pipe(fs.createWriteStream("./update.zip")).on('finish', function(){ | ||
AdmZip("./update.zip").extractAllTo("./update"); | ||
fs.unlink("./update.zip") | ||
resolve() | ||
}); | ||
}); | ||
}) | ||
} | ||
|
||
function moveFiles(){ | ||
return new Promise((resolve, reject) => { | ||
fs.readdirSync('./update').forEach(function(file, index){ | ||
fs.renameSync('./update/'+file, file); | ||
}); | ||
resolve() | ||
}) | ||
} | ||
|
||
function deleteFiles(){ | ||
return new Promise((resolve, reject) => { | ||
fs.readdirSync('./update').forEach(function(file, index){ | ||
var curPath = './update' + "/" + file; | ||
if (fs.lstatSync(curPath).isDirectory()) { | ||
deleteFolderRecursive(curPath); | ||
} else { | ||
fs.unlinkSync(curPath); | ||
} | ||
}); | ||
fs.rmdirSync('./update'); | ||
resolve() | ||
}) | ||
} |
Oops, something went wrong.