New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-factorio-api

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-factorio-api

Get data from the factorio mod portal and matchmaker

Source
npmnpm
Version
0.4.4-alpha
Version published
Weekly downloads
18
-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

node-factorio-api

Download and update mods from the Factorio Mod Portal

https://nodei.co/npm/node-factorio-api.png?downloads=true&downloadRank=true&stars=true

Dependency Status

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...]

Documentation

Useful information

Keywords

factorio

FAQs

Package last updated on 04 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts