wiki-plugin-shoppe 0.0.28 → 0.0.30

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/server.js +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-shoppe",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Multi-tenant digital goods shoppe for federated wiki, powered by Sanora",
5
5
  "keywords": [
6
6
  "wiki",
package/server/server.js CHANGED
@@ -2,6 +2,7 @@
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const crypto = require('crypto');
5
+ const { execSync } = require('child_process');
5
6
  const fetch = require('node-fetch');
6
7
  const multer = require('multer');
7
8
  const FormData = require('form-data');
@@ -672,9 +673,21 @@ async function lucilleUploadVideo(tenant, title, fileBuffer, filename, lucilleUr
672
673
  // ============================================================
673
674
 
674
675
  async function processArchive(zipPath) {
675
- const zip = new AdmZip(zipPath);
676
676
  const tmpDir = path.join(TMP_DIR, `extract-${Date.now()}`);
677
- zip.extractAllTo(tmpDir, true);
677
+ fs.mkdirSync(tmpDir, { recursive: true });
678
+ // Use system unzip to stream-extract without loading entire archive into RAM.
679
+ // AdmZip loads the whole zip into memory upfront, which OOM-kills Node on large archives.
680
+ try {
681
+ const unzipBin = (() => {
682
+ for (const p of ['/usr/bin/unzip', '/bin/unzip', '/usr/local/bin/unzip']) {
683
+ if (fs.existsSync(p)) return p;
684
+ }
685
+ return 'unzip'; // fallback, let it fail with a clear error
686
+ })();
687
+ execSync(`"${unzipBin}" -o "${zipPath}" -d "${tmpDir}"`, { stdio: 'pipe' });
688
+ } catch (err) {
689
+ throw new Error(`Failed to extract archive: ${err.stderr ? err.stderr.toString().trim() : err.message}`);
690
+ }
678
691
 
679
692
  try {
680
693
  // Find manifest.json — handle zips wrapped in a top-level folder and