node-factorio-api v0.4.6-alpha
node-factorio-api
Download and update mods from the Factorio Mod Portal
Table of Contents
Features
- Download mods
- Update mods
- Search/list mods
- Remove mods
- Download dependencies
- Get mods from saves (not implemented yet)
- Get mods from server (not implemented yet)
- Search/list servers (not implemented yet)
- Read mod zip file (get info.json)
- Download the game client (removed, since it was to much of a hack)
Installation
I recommend using yarn instead of npm, because it's (a lot) faster.
yarn add node-factorio-api (or npm install node-factorio-api)
Usage
// There are multiple classes now
import {Profile, FactorioAPI, Progress, Mod} from "./node-factorio-api";
// You can now (finally) get the progress. Just subscribe and it will trigger the callback every time something changes.
// It gives you an array of tasks that are currently running.
Progress.subscribe(tasks => {
tasks.map(task => console.log(`${task.name}: ${task.progress}`));
console.log("\n");
});
// I present to you: The Anonymous Asynchronous Self-Invoking Arrow Function (cuz that's a thing now)
(async () => {
// You can now create profiles! The path to the main folder of factorio is all it needs.
let profile = new Profile("/home/daan/Games/factorio/");
// It can even find your credentials automatically
await profile.authenticate();
// Tell the FactorioAPI to use this profile
FactorioAPI.useProfile(profile);
// Let it query the mods and wait for it to complete
await FactorioAPI.queryMods();
// Some mods...
let mods = FactorioAPI.getMods([
"boblogistics",
"rso-mod",
"clusterio"
]);
// Let's download them
await FactorioAPI.downloadLatestReleases(mods);
// This is kind of silly here, but oh well
await FactorioAPI.checkUpdates(mods);
// Let's see what we got installed
let installedReleases = await profile.getInstalledReleases();
// Let's make sure are mods can load properly, that wouldn't be a bad idea right?
for (let rel of installedReleases) {
await FactorioAPI.downloadDependencies(rel, false);
}
// Let's see what's enabled
await profile.loadModlist();
// Maybe just enable all of them
profile.installedReleases.forEach(rel => {
rel.enabled = true
});
// Don't forget to save!
await profile.saveModlist();
// Not working currently (it broke yet again, I don't think that would surprise anyone here)
let saveReleases = await FactorioAPI.getModsFromSaveFile("test.zip");
await FactorioAPI.downloadReleases(saveReleases);
})();Documentation Outdated! Coming soon...
Useful information
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
