Gonna be a Linux-focused launcher at some point, just some scripts for now.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
913B

  1. import fetch from 'node-fetch';
  2. import path from 'path';
  3. import fs from 'fs';
  4. async function download() {
  5. let response = await fetch("https://patcher-production.robocraft.org/Builds/builds_index.json");
  6. let json = await response.json();
  7. const latestBuild = json.AvailableBuilds.pop();
  8. console.log("Latest build:", latestBuild);
  9. response = await fetch(`https://patcher-production.robocraft.org/Builds/build_${latestBuild}.json`);
  10. json = await response.json();
  11. for (const entry of json.Entries) {
  12. console.log("Downloading", entry.RelativePath);
  13. await fs.promises.mkdir(path.dirname("game/" + entry.RelativePath), { recursive: true })
  14. response = await fetch(`https://patcher-production.robocraft.org/Builds/${latestBuild}/Game/${entry.RelativePath}`);
  15. const writeStream = fs.createWriteStream("game/" + entry.RelativePath);
  16. response.body.pipe(writeStream);
  17. }
  18. console.log("Done!");
  19. }
  20. download();