Socket
Socket
Sign inDemoInstall

satisfactory-json

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satisfactory-json - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

63

package.json
{
"name": "satisfactory-json",
"version": "0.0.23",
"author": "ficsit-felix",
"dependencies": {
"pako": "^1.0.10"
},
"description": "Convert Satisfactory save files to JSON and back",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": "https://github.com/bitowl/satisfactory-json",
"author": "bitowl",
"license": "MIT",
"devDependencies": {
"@types/node": "^12.0.4",
"gulp": "^4.0.2",
"gulp-plumber": "^1.2.1",
"gulp-typescript": "^5.0.1",
"ts-node": "^8.3.0",
"tslint": "^5.17.0",
"typescript": "^3.5.1"
"@types/node": "^12.7.5",
"@types/pako": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^2.3.1",
"@typescript-eslint/parser": "^2.3.1",
"commander": "^3.0.1",
"eslint": "^6.5.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^1.18.2",
"ts-node": "^8.4.1",
"typescript": "^3.6.3",
"v8-profiler-next": "^1.1.1"
},
"scripts": {
"build": "gulp",
"build:watch": "gulp watch",
"lint": "tslint --project \"./tsconfig.json\"",
"prepublish": "yarn build",
"postversion": "git push && git push --tags",
"sav2json": "node lib/cli/sav2json.js",
"json2sav": "node lib/cli/json2sav.js"
},
"files": [
"lib/**/*"
],
"bin": {
"sav2json": "./lib/sav2json.js",
"json2sav": "./lib/json2sav.js"
"license": "MIT",
"main": "lib/index.js",
"name": "satisfactory-json",
"publishConfig": {
"access": "public"
},
"dependencies": {
"commander": "^2.20.0"
}
"repository": "https://github.com/ficsit-felix/satisfactory-json",
"scripts": {
"build": "tsc --build tsconfig.json",
"build:watch": "tsc -w",
"lint": "eslint \"src/**\"",
"sav2json": "ts-node src/cli/sav2json.ts",
"sav2json:js": "node lib/cli/sav2json.js",
"json2sav": "ts-node src/cli/json2sav.ts",
"json2sav:js": "node lib/cli/json2sav.js",
"prepare-gpr": "sed -i 's/\"name\": \"satisfactory-json\"/\"name\": \"@ficsit-felix\\\/satisfactory-json\"/' package.json"
},
"types": "lib/index.d.ts",
"version": "0.0.24"
}

@@ -5,3 +5,23 @@ # satisfactory-json

## Usage
Using node streams:
```ts
import { SaveGame, Sav2JsonTransform, Json2SavTransform } from 'satisfactory-json';
// convert sav -> json
const readStream: ReadStream; // e.g. from fs.createReadStream
readStream.pipe(new Sav2JsonTransform()).on('data', saveGame => {
});
// convert json -> sav
const saveGame: SaveGame;
const writeStream: WriteStream; // e.g. from fs.createWriteStream
const transform = new Json2SavTransform();
transform.pipe(writeStream);
transform.write(saveGame);
transform.end();
```
Or using something similar to the previous interface:
```ts
import { SaveGame, sav2json, json2sav } from 'satisfactory-json';

@@ -11,5 +31,12 @@

// convert sav -> json
const saveGame: SaveGame = sav2json(saveFileData);
sav2json(saveFileData).then((saveGame: SaveGame) => {
});
// convert json -> sav
const saveData: string = json2sav(saveGame);
const saveGame: SaveGame;
json2sav(saveGame).then((saveData: string) => {
});
```

@@ -24,18 +51,1 @@

Progress towards a stable JSON interface can be observed at [milestone 0.1.0](https://github.com/ficsit-felix/satisfactory-json/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.1.0). As Satisfactory itself is still in Early Access the save file format will also probably change in breaking ways with each new game update.
### What does the preprocessor do?
The goal was to achieve bidirectional transformations from Archive to the variable as in the Unreal code. This is useful, because binary data has to be read in the same way it was written, so writing that code once saves the effort to keep the two functions in sync.
```
ar << property.name;
```
Problem is, TypeScript passes parameters by value and not by reference. The only way to be able to read or write to a variable seems to be to pass an object and a key to a variable in it:
```ts
ar.transformString(property, 'name');
```
By using strings as key we lose the most important feature of TypeScript, the Type Safety. So I wrote a preprocessor that converts the following code to the code above before sending it t the TypeScript compiler so that we can have the best of both worlds.
```ts
ar.transformString(property.name);
```
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