mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
update readme and bumb version
This commit is contained in:
parent
d9bfd671d1
commit
933d57dbda
2 changed files with 12 additions and 12 deletions
22
README.md
22
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# demo.js
|
# demo.js
|
||||||
|
|
||||||
[](https://travis-ci.org/icewind1991/demo.js)
|
[](https://travis-ci.org/demostf/demo.js)
|
||||||
|
|
||||||
Parsing of TF2 demo files in node.js and the browser
|
Parsing of TF2 demo files in node.js and the browser
|
||||||
|
|
||||||
|
|
@ -21,10 +21,10 @@ var fs = require('fs');
|
||||||
fs.readFile("example.dem", function (err, data) {
|
fs.readFile("example.dem", function (err, data) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
var demo = Demo.fromNodeBuffer(data);
|
var demo = Demo.fromNodeBuffer(data);
|
||||||
var parser = demo.getParser();
|
var analyser = demo.getAnalyser();
|
||||||
var head = parser.readHeader();
|
var head = analyser.getHeader();
|
||||||
console.log(head);
|
console.log(head);
|
||||||
var body = parser.parseBody();
|
var body = analyser.getBody();
|
||||||
console.log(body.getState());
|
console.log(body.getState());
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
@ -41,14 +41,13 @@ var fs = require('fs');
|
||||||
fs.readFile("example.dem", function (err, data) {
|
fs.readFile("example.dem", function (err, data) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
var demo = Demo.fromNodeBuffer(data);
|
var demo = Demo.fromNodeBuffer(data);
|
||||||
var parser = demo.getParser();
|
var analyser = demo.getAnalyser();
|
||||||
var head = parser.readHeader();
|
var head = analyser.getHeader();
|
||||||
var match = parser.match;
|
var match = analyser.match;
|
||||||
parser.on('packet', function(packet) {
|
for (const packet of analyser.getPackets()) {
|
||||||
// where you can either get information directly from the packet (see ./src/Data/Packet.ts)
|
// where you can either get information directly from the packet (see ./src/Data/Packet.ts)
|
||||||
// or use the `match` object which has contains an (incomplete) state of the match at the current tick
|
// or use the `match` object which has contains an (incomplete) state of the match at the current tick
|
||||||
});
|
}
|
||||||
parser.parseBody();
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -56,7 +55,8 @@ fs.readFile("example.dem", function (err, data) {
|
||||||
## A note on POV demos
|
## A note on POV demos
|
||||||
|
|
||||||
During the development of this project the main focus has always been on parsing
|
During the development of this project the main focus has always been on parsing
|
||||||
STV demos. Parsing POV demos is a lot more error prone and has known issues.
|
STV demos.
|
||||||
|
Although there are currently no known issues iwth POV demos parsing them is a lot more error prone.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "tf2-demo",
|
"name": "tf2-demo",
|
||||||
"description": "A parser for TF2 demo files",
|
"description": "A parser for TF2 demo files",
|
||||||
"version": "1.1.3",
|
"version": "2.0.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"demo-analyse": "./bin/analyse.js"
|
"demo-analyse": "./bin/analyse.js"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue