Reads a chosen file (or any Blob) as text, headless and in the browser alike: the
browser half of an import is the picker, this is the rest. Blob.text() needs no DOM,
so the same function reads a node:fs buffer's Blob in a tool.
Parameters
file: Blob
Returns Promise<string>
Example
import { importReplayFile, readReplayFile, version } from'@datamoc/mwg';
declareconstfile: Blob; // from pickReplayFile, or a Node-side Blob constjson = awaitreadReplayFile(file); constreplay = importReplayFile(json, { framework:version, game:'my-game' });
Reads a chosen file (or any Blob) as text, headless and in the browser alike: the browser half of an import is the picker, this is the rest.
Blob.text()needs no DOM, so the same function reads anode:fsbuffer's Blob in a tool.