haxelib git tink_json https://github.com/haxetink/tink_json
import slippihx.SlpDecoder;
import slippihx.SlpTypes;
class Main {
var slp = SlpDecoder.fromFile('replay.slp');
var metadata: SlpMetadata = slp.metadata;
trace(metadata.startAt);
// >> 2019-03-29T19:52:11Z
var rawData: Vector<UInt> = slp.raw;
trace(rawData);
// Vector bigger than Leffen winning EVO.
}
On ActionScript3, Flash and JavaScript SlpDecoder.fromFile()
is not available because it uses the the filesystem to read a file, and those targets don't have support for that out of the box.
For AS3 and Flash, you can use OpenFL.
For JavaScript, you can use hxnodejs to read files and then:
// Must include '-lib hxnodejs'
import slippihx.SlpDecoder;
class Main {
var bytes = sys.io.File.read('replay.slp', true).readAll();
var slp = new SlpDecoder(bytes);
// Use SlpDecoder normally...
}