@beltar/n8n-nodes-extract-archive 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,6 @@ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription
2
2
  export declare class ExtractArchive implements INodeType {
3
3
  description: INodeTypeDescription;
4
4
  private detectArchiveType;
5
- private checkToolAvailable;
6
5
  private extractZip;
7
6
  private extractRar;
8
7
  private getAllFiles;
@@ -32,16 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.ExtractArchive = void 0;
37
40
  const n8n_workflow_1 = require("n8n-workflow");
38
- const child_process_1 = require("child_process");
39
41
  const fs = __importStar(require("fs"));
40
42
  const crypto = __importStar(require("crypto"));
41
43
  const path = __importStar(require("path"));
42
- const util_1 = require("util");
43
44
  const promises_1 = require("stream/promises");
44
- const execAsync = (0, util_1.promisify)(child_process_1.exec);
45
+ const adm_zip_1 = __importDefault(require("adm-zip"));
45
46
  class ExtractArchive {
46
47
  constructor() {
47
48
  this.description = {
@@ -246,26 +247,9 @@ class ExtractArchive {
246
247
  // Default to zip
247
248
  return 'zip';
248
249
  }
249
- checkToolAvailable(tool) {
250
- try {
251
- (0, child_process_1.execSync)(`which ${tool}`, { encoding: 'utf-8', stdio: 'pipe' });
252
- return true;
253
- }
254
- catch {
255
- return false;
256
- }
257
- }
258
250
  async extractZip(archivePath, outputDir, password) {
259
- if (!this.checkToolAvailable('unzip')) {
260
- throw new Error('unzip is not installed. Please install it: apk add unzip (Alpine) or apt-get install unzip (Debian/Ubuntu)');
261
- }
262
- const args = ['-o', '-q']; // Overwrite, quiet
263
- if (password) {
264
- args.push('-P', password);
265
- }
266
- args.push(archivePath, '-d', outputDir);
267
- const command = `unzip ${args.map(a => `"${a}"`).join(' ')}`;
268
- await execAsync(command);
251
+ const zip = new adm_zip_1.default(archivePath);
252
+ zip.extractAllTo(outputDir, true, undefined, password || undefined);
269
253
  }
270
254
  async extractRar(archivePath, outputDir, password) {
271
255
  const { createExtractorFromFile } = await Promise.resolve().then(() => __importStar(require('node-unrar-js')));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beltar/n8n-nodes-extract-archive",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "n8n node to extract ZIP and RAR archive files. Supports binary data or file path input.",
5
5
  "keywords": [
6
6
  "n8n",
@@ -40,6 +40,7 @@
40
40
  ]
41
41
  },
42
42
  "devDependencies": {
43
+ "@types/adm-zip": "^0.5.7",
43
44
  "@types/node": "^20.10.0",
44
45
  "n8n-workflow": "^1.20.0",
45
46
  "shx": "^0.4.0",
@@ -52,6 +53,7 @@
52
53
  "node": ">=18.0.0"
53
54
  },
54
55
  "dependencies": {
56
+ "adm-zip": "^0.5.16",
55
57
  "node-unrar-js": "^2.0.2"
56
58
  }
57
59
  }