parseck2
Version:
Parse a Crusader Kings II saved game file into a usable JavaScript object.
40 lines (25 loc) • 1.41 kB
Markdown
parseck2
=========
### Parse a [Crusader Kings II](http://www.crusaderkings.com/) save game file into a JSON object.
`parseck2` will parse an uncompressed [Crusader Kings II](http://www.crusaderkings.com/) save game file into a usable JSON object with the game data. Save game files can be quite large. The resulting JSON is slightly larger still, so parsing and transforming this data does take a bit of time, on the order of a few minutes.
I owe a great deal to [Chris Kjær's](https://github.com/chriskjaer) [ck2parser](https://github.com/chriskjaer/ck2parser) project, as well as [PEG.js](https://pegjs.org/), which generated the script that first parses the save game file to JSON. This first pass is a bit rough, so this package also uses a transformer to make the JSON more useful.
Installation
------------
You can install with `npm`:
``` bash
$ npm install parseck2 --save
```
How to Use
----------
To use `parseck2` in your own scripts, first require it:
To compile your native addon, first go to its root directory:
```
var ck2parse = require('ck2parse');
```
Then call it as a function, passing the path of the file you'd like to parse as a parameter. It will return the JSON object.
```
var data = ck2parse("/path/to/ck2/autosave.ck2");
```
License
----------
[Creative Commons Attribution Share-Alike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/)