@arela/uploader 1.0.19 → 1.0.20
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
CHANGED
package/src/config/config.js
CHANGED
|
@@ -36,10 +36,10 @@ class Config {
|
|
|
36
36
|
const __dirname = path.dirname(__filename);
|
|
37
37
|
const packageJsonPath = path.resolve(__dirname, '../../package.json');
|
|
38
38
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
39
|
-
return packageJson.version || '1.0.
|
|
39
|
+
return packageJson.version || '1.0.20';
|
|
40
40
|
} catch (error) {
|
|
41
41
|
console.warn('⚠️ Could not read package.json version, using fallback');
|
|
42
|
-
return '1.0.
|
|
42
|
+
return '1.0.20';
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
package/src/file-detection.js
CHANGED
|
@@ -155,12 +155,12 @@ export class FileDetectionService {
|
|
|
155
155
|
* @returns {Promise<string>} - Extracted text
|
|
156
156
|
*/
|
|
157
157
|
async extractTextFromPDF(filePath) {
|
|
158
|
+
let parser;
|
|
158
159
|
try {
|
|
159
160
|
const dataBuffer = fs.readFileSync(filePath);
|
|
160
|
-
// Convert Buffer to Uint8Array as required by pdf-parse
|
|
161
161
|
const uint8Array = new Uint8Array(dataBuffer);
|
|
162
|
-
|
|
163
|
-
const result = await
|
|
162
|
+
parser = new PDFParse({ data: uint8Array });
|
|
163
|
+
const result = await parser.getText();
|
|
164
164
|
return result.text;
|
|
165
165
|
} catch (error) {
|
|
166
166
|
console.error(
|
|
@@ -168,6 +168,10 @@ export class FileDetectionService {
|
|
|
168
168
|
error.message,
|
|
169
169
|
);
|
|
170
170
|
throw new Error(`Failed to extract text from PDF: ${error.message}`);
|
|
171
|
+
} finally {
|
|
172
|
+
if (parser) {
|
|
173
|
+
await parser.destroy();
|
|
174
|
+
}
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
|
|
@@ -46,7 +46,7 @@ export class LoggingService {
|
|
|
46
46
|
});
|
|
47
47
|
process.on('unhandledRejection', (reason, promise) => {
|
|
48
48
|
this.error(`Unhandled Rejection at: ${promise}, reason: ${reason}`);
|
|
49
|
-
|
|
49
|
+
// Don't kill the process — allow it to continue processing remaining files
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|