@etothepii/satisfactory-file-parser
Advanced tools
Comparing version 0.0.14 to 0.0.15
{ | ||
"name": "@etothepii/satisfactory-file-parser", | ||
"author": "etothepii", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "A file parser for satisfactory files. Includes save files and blueprint files.", | ||
@@ -6,0 +6,0 @@ "main": "build/index.js", |
@@ -32,6 +32,21 @@ # Satisfactory File Parser | ||
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. | ||
```js | ||
import { SaveParser } from "@etothepii/satisfactory-file-parser"; | ||
SaveParser.WriteSave(parsedSave); | ||
let header, bodyChunks; | ||
SaveParser.WriteSave(save, binaryBeforeCompressed => {}, header => { | ||
console.log('on save header.'); | ||
header = header; | ||
}, chunk => { | ||
console.log('on save body chunk.'); | ||
bodyChunks.push(chunk); | ||
}, summary => { | ||
console.log('finished writing chunks.'); | ||
// write complete sav file back to disk | ||
fs.writeFileSync('./MyModifiedSave.sav', Buffer.concat([header, ...bodyChunks])); | ||
}); | ||
``` | ||
@@ -38,0 +53,0 @@ |
162030
56