Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

keynote-parser2

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keynote-parser2 - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+2
-2
lib/parse/parse-iwa-snappy-frame.d.ts

@@ -11,5 +11,5 @@ /// <reference types="node" />

*/
export declare const parseIwaSnappyFrame: (data: Buffer, cursor: number) => Promise<{
export declare const parseIwaSnappyFrame: (data: Buffer, cursor: number) => {
chunk: Buffer;
nextCursor: number;
}>;
};

@@ -7,3 +7,3 @@ "use strict";

exports.parseIwaSnappyFrame = void 0;
const snappy_1 = __importDefault(require("snappy"));
const snappyjs_1 = __importDefault(require("snappyjs"));
/**

@@ -18,3 +18,3 @@ * Unpack IWA file chunk data from snappy frame

*/
const parseIwaSnappyFrame = async (data, cursor) => {
const parseIwaSnappyFrame = (data, cursor) => {
// the first byte of the frame is always 0x00

@@ -32,3 +32,3 @@ if (data[cursor] !== 0x00) {

// uncompress the chunk data
const chunk = (await snappy_1.default.uncompress(chunkBuffer));
const chunk = snappyjs_1.default.uncompress(chunkBuffer);
return {

@@ -35,0 +35,0 @@ chunk,

@@ -7,2 +7,2 @@ /// <reference types="node" />

*/
export declare const parseIwaSnappy: (data: Buffer) => Promise<Buffer>;
export declare const parseIwaSnappy: (data: Buffer) => Buffer;

@@ -10,3 +10,3 @@ "use strict";

*/
const parseIwaSnappy = async (data) => {
const parseIwaSnappy = (data) => {
// unpack the snappy frames one by one

@@ -16,3 +16,3 @@ const chunks = [];

while (cursor < data.length - 4) {
const { chunk, nextCursor } = await (0, parse_iwa_snappy_frame_1.parseIwaSnappyFrame)(data, cursor);
const { chunk, nextCursor } = (0, parse_iwa_snappy_frame_1.parseIwaSnappyFrame)(data, cursor);
chunks.push(chunk);

@@ -19,0 +19,0 @@ cursor = nextCursor;

@@ -8,2 +8,2 @@ /// <reference types="node" />

*/
export declare const parseIwa: (data: Buffer) => Promise<IwaData>;
export declare const parseIwa: (data: Buffer) => IwaData;

@@ -11,4 +11,4 @@ "use strict";

*/
const parseIwa = async (data) => {
const protobufData = await (0, parse_iwa_snappy_1.parseIwaSnappy)(data);
const parseIwa = (data) => {
const protobufData = (0, parse_iwa_snappy_1.parseIwaSnappy)(data);
const iwaData = (0, parse_iwa_protobuf_1.parseIwaProtobuf)(protobufData);

@@ -15,0 +15,0 @@ return iwaData;

@@ -7,3 +7,2 @@ "use strict";

exports.parse = void 0;
const node_path_1 = __importDefault(require("node:path"));
const decompress_1 = __importDefault(require("decompress"));

@@ -23,20 +22,15 @@ const fs_extra_1 = __importDefault(require("fs-extra"));

}
// unzip keynote file and filter iwa files
const iwaFiles = [];
// unzip keynote file and parse iwa files
await (0, decompress_1.default)(inputPath, outputPath, {
filter: (file) => {
if ((0, utils_1.isIwaFile)(file.path)) {
iwaFiles.push(file);
return false;
}
return true;
map: (file) => {
if (!(0, utils_1.isIwaFile)(file.path))
return file;
return {
...file,
data: Buffer.from(JSON.stringify((0, parse_iwa_1.parseIwa)(file.data), null, 2)),
path: `${file.path}.json`,
};
},
});
// parse iwa files and output parsed result to json files
await Promise.all(iwaFiles.map(async (iwaFile) => {
const iwaData = await (0, parse_iwa_1.parseIwa)(iwaFile.data);
const iwaDataPath = node_path_1.default.resolve(outputPath, `${iwaFile.path}.json`);
await fs_extra_1.default.outputJSON(iwaDataPath, iwaData, { spaces: 2 });
}));
};
exports.parse = parse;
{
"name": "keynote-parser2",
"version": "0.2.0",
"version": "0.3.0",
"description": "A library for parsing Apple Keynote file",

@@ -43,3 +43,3 @@ "keywords": [

"protobufjs": "^7.2.2",
"snappy": "^7.2.2",
"snappyjs": "^0.7.0",
"varint": "^6.0.0"

@@ -46,0 +46,0 @@ },

@@ -41,3 +41,3 @@ # keynote-parser2

const data = await fs.readFile('/path/to/iwa_file.iwa');
const iwaData = await parseIwa(data);
const iwaData = parseIwa(data);
```

@@ -44,0 +44,0 @@