keynote-parser2
Advanced tools
| #!/usr/bin/env node | ||
| const { cli } = require('../lib/cli'); | ||
| cli(); |
| export declare const cli: () => void; |
+24
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.cli = void 0; | ||
| const node_path_1 = __importDefault(require("node:path")); | ||
| const node_process_1 = __importDefault(require("node:process")); | ||
| const parse_1 = require("./parse"); | ||
| const cli = () => { | ||
| // get input and output args | ||
| const input = node_process_1.default.argv[2]; | ||
| const output = node_process_1.default.argv[3] || `${input}.parsed`; | ||
| // resolve paths according to cwd | ||
| const cwd = node_process_1.default.cwd(); | ||
| const inputPath = node_path_1.default.resolve(cwd, input); | ||
| const outputPath = node_path_1.default.resolve(cwd, output); | ||
| // parse | ||
| (0, parse_1.parse)(inputPath, outputPath).catch((error) => { | ||
| console.error(error); | ||
| node_process_1.default.exit(1); | ||
| }); | ||
| }; | ||
| exports.cli = cli; |
@@ -29,2 +29,3 @@ "use strict"; | ||
| // TODO: handle messageInfo.type = 0 | ||
| // @see https://github.com/psobot/keynote-parser/blob/48d4204ab943fc7ee75fd14881a54ad5264680f5/keynote_parser/codec.py#L189-L193 | ||
| const messageBufferStart = nextCursor; | ||
@@ -37,10 +38,8 @@ const messageBufferEnd = nextCursor + messageInfo.length; | ||
| const message = messageProto.decode(messageBuffer); | ||
| messages.push({ | ||
| messageProtoName, | ||
| message, | ||
| }); | ||
| messages.push({ messageProtoName, message }); | ||
| } | ||
| catch (error) { | ||
| // eslint-disable-next-line no-console | ||
| console.error(error); | ||
| if (!(error instanceof Error)) | ||
| throw error; | ||
| console.warn('Skip message, reason:', error.message); | ||
| } | ||
@@ -47,0 +46,0 @@ } |
+26
-22
| { | ||
| "name": "keynote-parser2", | ||
| "version": "0.4.1", | ||
| "version": "0.5.0", | ||
| "description": "A library for parsing Apple Keynote file", | ||
@@ -20,3 +20,7 @@ "keywords": [ | ||
| "types": "./lib/index.d.ts", | ||
| "bin": { | ||
| "keynote-parser": "./bin/keynote-parser.js" | ||
| }, | ||
| "files": [ | ||
| "bin", | ||
| "lib", | ||
@@ -38,5 +42,5 @@ "proto" | ||
| "decompress": "^4.2.1", | ||
| "fs-extra": "^11.1.0", | ||
| "fs-extra": "^11.1.1", | ||
| "lodash.get": "^4.4.2", | ||
| "protobufjs": "^7.2.2", | ||
| "protobufjs": "^7.2.4", | ||
| "snappyjs": "^0.7.0", | ||
@@ -46,29 +50,29 @@ "varint": "^6.0.0" | ||
| "devDependencies": { | ||
| "@commitlint/cli": "^17.4.4", | ||
| "@commitlint/config-conventional": "^17.4.4", | ||
| "@meteorlxy/eslint-config-prettier": "^2.21.0", | ||
| "@meteorlxy/eslint-config-prettier-typescript": "^2.22.0", | ||
| "@commitlint/cli": "^17.6.6", | ||
| "@commitlint/config-conventional": "^17.6.6", | ||
| "@meteorlxy/eslint-config-prettier": "^2.24.0", | ||
| "@meteorlxy/eslint-config-prettier-typescript": "^2.24.0", | ||
| "@meteorlxy/prettier-config": "^2.11.0", | ||
| "@meteorlxy/tsconfig": "^2.16.0", | ||
| "@meteorlxy/tsconfig": "^2.23.1", | ||
| "@types/decompress": "^4.2.4", | ||
| "@types/fs-extra": "^11.0.1", | ||
| "@types/lodash.get": "^4.4.7", | ||
| "@types/node": "^18.14.0", | ||
| "@types/node": "^20.3.3", | ||
| "@types/varint": "^6.0.1", | ||
| "@vitest/coverage-istanbul": "^0.28.5", | ||
| "conventional-changelog-cli": "^2.2.2", | ||
| "eslint": "^8.34.0", | ||
| "fast-glob": "^3.2.12", | ||
| "@vitest/coverage-istanbul": "^0.32.4", | ||
| "conventional-changelog-cli": "^3.0.0", | ||
| "eslint": "^8.44.0", | ||
| "fast-glob": "^3.3.0", | ||
| "husky": "^8.0.3", | ||
| "lint-staged": "^13.1.2", | ||
| "long": "^5.2.1", | ||
| "prettier": "^2.8.4", | ||
| "lint-staged": "^13.2.3", | ||
| "long": "^5.2.3", | ||
| "prettier": "^2.8.8", | ||
| "protobufjs-cli": "^1.1.1", | ||
| "rimraf": "^4.1.2", | ||
| "sort-package-json": "^2.4.1", | ||
| "typescript": "^4.9.5", | ||
| "vite": "^4.1.3", | ||
| "vitest": "^0.28.5" | ||
| "rimraf": "^5.0.1", | ||
| "sort-package-json": "^2.5.0", | ||
| "typescript": "^5.1.6", | ||
| "vite": "^4.3.9", | ||
| "vitest": "^0.32.4" | ||
| }, | ||
| "packageManager": "pnpm@7.27.1", | ||
| "packageManager": "pnpm@8.6.6", | ||
| "scripts": { | ||
@@ -75,0 +79,0 @@ "build": "tsc -b tsconfig.build.json", |
+8
-1
@@ -19,4 +19,11 @@ # keynote-parser2 | ||
| TODO | ||
| Parse keynote (.key) file: | ||
| ```sh | ||
| # output the parsed result to `keynote_file.key.parsed` by default | ||
| keynote-parser keynote_file.key | ||
| # specify the output directory | ||
| keynote-parser keynote_file.key keynote_file_parsed_directory | ||
| ``` | ||
| ### Node.js API | ||
@@ -23,0 +30,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
32922876
035
9.38%3048
0.89%60
13.21%Updated
Updated