mwg API
    Preparing search index...

    Function importReplayFile

    • Parses and checks a replay file, refusing by name anything that is not this game on this framework: a replay from another build does not fail somewhere mid-playback, it is rejected at the door with what it actually carries.

      Parameters

      • json: string
      • expect: { framework: string; game: string }

      Returns ReplayFile

      import { importReplayFile, version } from '@datamoc/mwg';

      declare const json: string; // read from a file, see readReplayFile
      const file = importReplayFile(json, { framework: version, game: 'my-game' });
      console.log(file.events.length, file.seed);