UNPKG

keynote-parser2

Version:

A library for parsing Apple Keynote file

22 lines (21 loc) 749 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseIwaSnappy = void 0; const parse_iwa_snappy_frame_1 = require("./parse-iwa-snappy-frame"); /** * Parse IWA file snappy-compressed data * * @see https://github.com/obriensp/iWorkFileFormat/blob/master/Docs/index.md#snappy-compression */ const parseIwaSnappy = (data) => { // unpack the snappy frames one by one and concat them const chunks = []; let cursor = 0; while (cursor < data.length - 4) { const { chunk, nextCursor } = (0, parse_iwa_snappy_frame_1.parseIwaSnappyFrame)(data, cursor); chunks.push(chunk); cursor = nextCursor; } return Buffer.concat(chunks); }; exports.parseIwaSnappy = parseIwaSnappy;