wiki-plugin-shoppe 0.0.28 → 0.0.29
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.
- package/package.json +1 -1
- package/server/server.js +9 -2
package/package.json
CHANGED
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,15 @@ 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
|
-
|
|
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
|
+
execSync(`unzip -o "${zipPath}" -d "${tmpDir}"`, { stdio: 'pipe' });
|
|
682
|
+
} catch (err) {
|
|
683
|
+
throw new Error(`Failed to extract archive: ${err.stderr ? err.stderr.toString().trim() : err.message}`);
|
|
684
|
+
}
|
|
678
685
|
|
|
679
686
|
try {
|
|
680
687
|
// Find manifest.json — handle zips wrapped in a top-level folder and
|