The only libary that can parse 100% of fortnite replays.
npm i fortnite-replay-parser
or
yarn add fortnite-replay-parser
Writing code with this library is pretty straight-forward as there is only one function.
The function takes two arguments:
- The buffer of the replay file, which can easily be obtained by using fs.
- (optional) A config that allows you to customize some things (e.g.
parseLevel
).
const fs = require('fs');
const parseReplay = require('fortnite-replay-parser');
const replayBuffer = fs.readFileSync('your.replay');
const config = {
parseLevel: 10,
debug: true,
}
parseReplay(replayBuffer, config).then((parsedReplay) => {
fs.writeFileSync('replayData.json', JSON.stringify(parsedReplay));
}).catch((err) => {
console.error('An error occured while parsing the replay!', err);
});
You (very) often don't need all of the data that is parsed, which is why there is an option that lets you specify which data you want to parse. It will also greatly improve the parser's speed. The tutorial on how to do that is here.
If you're using Node v14 or v15 you have to start process with --experimental-wasm-simd