@zebbedaja/er-save-parser 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.d.mts +14 -2
- package/dist/index.mjs +507 -464
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,8 +33,14 @@ import { parse, type Save, type Slot, type Character } from '@zebbedaja/er-save-
|
|
|
33
33
|
import { readFileSync } from 'fs'
|
|
34
34
|
|
|
35
35
|
const buffer = readFileSync('ER0000.sl2').buffer
|
|
36
|
+
|
|
37
|
+
// Default: only errors are logged (logLevel: 'error')
|
|
36
38
|
const save: Save = parse(buffer)
|
|
37
39
|
|
|
40
|
+
// Optional: configure logging with one of 'debug', 'info', 'warn', 'error', 'none'
|
|
41
|
+
// const save: Save = parse(buffer, { logLevel: 'debug' }) // Verbose progress logs
|
|
42
|
+
// const save: Save = parse(buffer, { logLevel: 'none' }) // Silent
|
|
43
|
+
|
|
38
44
|
console.log(save.steamId)
|
|
39
45
|
console.log(save.settings?.hud)
|
|
40
46
|
|
|
@@ -65,8 +71,14 @@ import { parse } from '@zebbedaja/er-save-parser'
|
|
|
65
71
|
import { readFileSync } from 'node:fs'
|
|
66
72
|
|
|
67
73
|
const buffer = readFileSync('ER0000.sl2').buffer
|
|
74
|
+
|
|
75
|
+
// Default: only errors are logged (logLevel: 'error')
|
|
68
76
|
const save = parse(buffer)
|
|
69
77
|
|
|
78
|
+
// Optional: configure logging with one of 'debug', 'info', 'warn', 'error', 'none'
|
|
79
|
+
// const save = parse(buffer, { logLevel: 'debug' }) // Verbose progress logs
|
|
80
|
+
// const save = parse(buffer, { logLevel: 'none' }) // Silent
|
|
81
|
+
|
|
70
82
|
console.log(save.steamId)
|
|
71
83
|
console.log(save.settings?.hud)
|
|
72
84
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
//#region src/types.d.ts
|
|
2
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
|
|
3
|
+
interface ParseOptions {
|
|
4
|
+
logLevel?: LogLevel;
|
|
5
|
+
}
|
|
2
6
|
interface Save {
|
|
3
7
|
magicBytes?: string;
|
|
4
8
|
checksum?: string;
|
|
@@ -139,6 +143,14 @@ interface EventFlag {
|
|
|
139
143
|
}
|
|
140
144
|
//#endregion
|
|
141
145
|
//#region src/parser.d.ts
|
|
142
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Parse an Elden Ring save file buffer.
|
|
148
|
+
*
|
|
149
|
+
* @param buffer - The ArrayBuffer containing the save file data
|
|
150
|
+
* @param options - Optional configuration for parsing
|
|
151
|
+
* @param options.logLevel - Log level threshold: 'debug', 'info', 'warn', 'error', or 'none'. Defaults to 'error'
|
|
152
|
+
* @returns A Save object containing parsed slot and profile data
|
|
153
|
+
*/
|
|
154
|
+
declare function parse(buffer: ArrayBuffer, options?: ParseOptions): Save;
|
|
143
155
|
//#endregion
|
|
144
|
-
export { type Character, type EventFlag, type ProfileSummary, type Save, type Settings, type Slot, parse };
|
|
156
|
+
export { type Character, type EventFlag, type LogLevel, type ParseOptions, type ProfileSummary, type Save, type Settings, type Slot, parse };
|