Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@etothepii/satisfactory-file-parser

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etothepii/satisfactory-file-parser

A file parser for satisfactory files. Includes save files and blueprint files.

  • 0.0.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by994.37%
Maintainers
1
Weekly downloads
 
Created
Source

Satisfactory File Parser

This is an NPM TypeScript Module to parse Satisfactory Files. Satisfactory is a game released by Coffee Stain Studios.

The Module is written entirely in TypeScript and comes with Type Definitions.

This parser can read, modify and write:

  • Save Files .sav
  • Blueprint Files .sbp, .sbpcfg

Supported Versions

Game Version Files of U5 and below are NOT supported. However, U6 and above is perfectly fine and parsable.

  • ✅ U7
  • ✅ U6
  • ❌ <= U5

U8 is on the Horizon!

We can not promise that U8 saves will work out of the box! If there will be changes, those will come very soon as soon as U8 is out on Experimental.

Installation via npm

npm install @etothepii/satisfactory-file-parser

Usage of Save Parsing

Usage of the SaveParser is easy. For reading a save file (.sav), just pass a Buffer to the parser with the file content.

import * as fs from 'fs';
import { Parser } from "@etothepii/satisfactory-file-parser";

const file = fs.readFileSync('./MySave.sav') as Buffer;
const parsedSave = Parser.ParseSaveFile(file);

Consequently, writing a parsed save file back is just as easy. The SaveParser has callbacks to assist in syncing on different occasions during the process. For example, when writing the header or when writing a chunk of the save body. The splitting in individual chunks enables you to more easily stream the binary data to somewhere else.

import * as fs from 'fs';
import { Parser } from "@etothepii/satisfactory-file-parser";

let header, bodyChunks = [];
Parser.WriteSave(save, binaryBeforeCompressed => {
    console.log('on binary data before being compressed.');
}, header => {
    console.log('on save header.');
    header = header;
}, chunk => {
    console.log('on save body chunk.');
    bodyChunks.push(chunk);
});

// write complete sav file back to disk
fs.writeFileSync('./MyModifiedSave.sav', Buffer.concat([header, ...bodyChunks]));

Usage of Blueprint Parsing

Blueprint parsing works very similiar. Note, that blueprints consist of 2 files. The .sbp main file and the config file .sbpcfg.

import * as fs from 'fs';
import { Parser } from "@etothepii/satisfactory-file-parser";

const mainFile = fs.readFileSync('./MyBlueprint.sbp') as Buffer;
const configFile = fs.readFileSync('./MyBlueprint.sbpcfg') as Buffer;
const parsedBlueprint = Parser.ParseBlueprintFiles('MyBlueprint', mainFile, configFile);

Consequently, writing a blueprint into binary data works the same way with getting callbacks in the same style as the save parsing.

import * as fs from 'fs';
import { Parser } from "@etothepii/satisfactory-file-parser";

let mainFileHeader, mainFileBodyChunks = [];
const summary = Parser.WriteBlueprintFiles(blueprint, mainFileBinaryBeforeCompressed => {
    console.log('on main file binary data before being compressed.');
}, header => {
    console.log('on main file blueprint header.');
    mainFileHeader = header;
}, chunk => {
    console.log('on main file blueprint body chunk.');
    mainFileBodyChunks.push(chunk);
});

// write complete .sbp file back to disk
fs.writeFileSync('./MyModifiedBlueprint.sbp', Buffer.concat([mainFileHeader, ...mainFileBodyChunks]));

// write .sbpcfg file back to disk, we get that data from the result of WriteBlueprint
fs.writeFileSync('./MyModifiedSave.sbpcfg', Buffer.from(summary.configFileBinary));

License

MIT

The module's code is free to use and open source.

Keywords

FAQs

Package last updated on 27 Mar 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc