https://github.com/oknehsorod/grand-theft-parser
Save reader for .b files
https://github.com/oknehsorod/grand-theft-parser
Last synced: 6 days ago
JSON representation
Save reader for .b files
- Host: GitHub
- URL: https://github.com/oknehsorod/grand-theft-parser
- Owner: Oknehsorod
- Created: 2022-05-24T12:25:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-27T23:28:10.000Z (over 3 years ago)
- Last Synced: 2025-08-01T16:04:23.116Z (2 months ago)
- Language: TypeScript
- Size: 98.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GTA San Andreas Savefile Parser
This is a simple parser for .b files of GTA SA.### How to use
```ts
import { GTASAUtils } from 'gtasa-savefile-to-json';const gtasaUtils = new GTASAUtils();
// Parse file via NodeJS fs
gtasaUtils.parseSaveFileByPath('/to/your/gtasa/savefile/GTASAsf1.b').then(savefile => {
console.log(savefile)
});// Parse buffer
const yourBufferWithSaveFile = new Buffer();
const savefile = gtasaUtils.parseSaveFileByBuffer(yourBufferWithSaveFile);
```### Parser Returned Value
```ts
export type SaveFile = {
missions: ScriptFormat['missions']; // All missions in the game [nameOfTheMission]: boolean
schools: ScriptFormat['schools']; // All schools in the game (driving,flying,boat,bike)
stats: StatsBlock; // Statistic of your savefile (your skills, records, etc.)
player: PlayerInfoBlock & {
weapons: { type: string; ammo: number }[]; // What weapons CJ has in the game
cars: GarageCarStructure[]; // What cars CJ has in the garages
};
collectables: {
oysters: CollectedItem; // Data for oyster collectable, it has full array of data
horseshoes: CollectedItem; // Data for horseshoe collectable, if you collected all of them then this array will be empty
snapshots: CollectedItem; // Data for snapshot collectable, if you collected all of them then this array wil be various length but with isCollected: true in every item of array;
tags: CollectedItem; // Data for tags collectable, it has full array of data
stuntJumps: CollectedItem; // Data for stunt jump collectable, it has full array of data
};
};
```