Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as fs from "fs";
- import * as JSZip from "jszip";
- interface Location {
- timestampMs: string;
- latitudeE7: number;
- longitudeE7: number;
- accuracy: number;
- }
- export async function toKml(takeout: ArrayBuffer | Blob) {
- const zip = await JSZip.loadAsync(takeout);
- const content = await zip
- .folder("Takeout")
- .folder("Location History")
- .file("Location History.json")
- .async("text");
- const { locations } = JSON.parse(content) as {
- locations: Location[];
- };
- return locations;
- }
- const f = fs.readFileSync("takeout.zip");
- toKml(f.buffer.slice(f.byteOffset, f.byteOffset + f.byteLength));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement