UNPKG

keynote-parser2

Version:

A library for parsing Apple Keynote file

23 lines (22 loc) 842 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseIwaProtobuf = void 0; const parse_iwa_protobuf_archive_info_1 = require("./parse-iwa-protobuf-archive-info"); /** * Parse IWA protobuf data * * @see https://github.com/obriensp/iWorkFileFormat/blob/master/Docs/index.md#protobuf */ const parseIwaProtobuf = (data) => { // parse the protobuf data one by one and store them in an object const iwaData = {}; let cursor = 0; while (cursor < data.length) { const { archiveInfoData, nextCursor } = (0, parse_iwa_protobuf_archive_info_1.parseIwaProtobufArchiveInfo)(data, cursor); iwaData[archiveInfoData.archiveInfo.identifier.toString()] = archiveInfoData; cursor = nextCursor; } return iwaData; }; exports.parseIwaProtobuf = parseIwaProtobuf;