import PolylineUtility from './PolylineUtility' import XcTrackParser from './index' import fs from 'fs' import qrcode from 'qrcode' const json = ` { "version": 2, "taskType": "CLASSIC", "t": [ { "z": "xry~FfxgrB_cA?", "n": "D01106" }, { "z": "xry~FfxgrB_cA_yF", "n": "D01106", "t": 2 }, { "z": "r{o|F|wzrBcGotL", "n": "A12013" }, { "z": "jhb~FtlarBwH_|B", "n": "A07015" }, { "z": "rcp~F|_lsB{OowH", "n": "B22027" }, { "z": "x\`y~FxvorBuI_|B", "n": "A05017", "t": 3 }, { "z": "x\`y~FxvorBuIgE", "n": "A05017" } ], "s": { "t": 2, "d": 2, "g": [ "15:00:00Z" ] }, "g": { "t": 1, "d": "20:30:00Z" } } `; const task = XcTrackParser.parseJson(json) const compressedTask = XcTrackParser.compressTask(task) qrcode.toFile('qr-code.png', compressedTask, function (err) { if (err) throw err; console.log('QR code saved!'); })