resolved type errors and other proc. app build error

This commit is contained in:
user
2026-03-02 19:23:59 +02:00
parent 6069a16d80
commit be45cc3fa7
7 changed files with 32 additions and 17 deletions

View File

@@ -1,6 +1,10 @@
import { createHash } from "crypto";
import type { DocumentProcessingOptions, FileProcessingResult } from "../data";
function asByteArray(input: Buffer | Uint8Array): Uint8Array {
return Uint8Array.from(input);
}
/**
* Process documents (PDF, text files, etc.)
*/
@@ -78,8 +82,8 @@ async function processPDF(
return {
processed: true,
originalFile: buffer,
processedFile: buffer, // PDFs typically don't need processing
originalFile: asByteArray(buffer),
processedFile: asByteArray(buffer), // PDFs typically don't need processing
metadata,
};
}
@@ -108,8 +112,8 @@ async function processTextFile(
return {
processed: true,
originalFile: buffer,
processedFile: buffer,
originalFile: asByteArray(buffer),
processedFile: asByteArray(buffer),
metadata,
};
}
@@ -125,8 +129,8 @@ async function processGenericDocument(
return {
processed: true,
originalFile: buffer,
processedFile: buffer,
originalFile: asByteArray(buffer),
processedFile: asByteArray(buffer),
metadata,
};
}

View File

@@ -145,9 +145,11 @@ export async function processImage(
return {
processed: true,
originalFile: inputBuffer,
processedFile: processedBuffer,
thumbnail: thumbnailBuffer,
originalFile: Uint8Array.from(inputBuffer),
processedFile: Uint8Array.from(processedBuffer),
thumbnail: thumbnailBuffer
? Uint8Array.from(thumbnailBuffer)
: undefined,
metadata,
};
} catch (error) {

View File

@@ -49,8 +49,8 @@ export async function processVideo(
return {
processed: true,
originalFile: inputBuffer,
processedFile: inputBuffer, // Videos are typically not re-encoded during upload
originalFile: Uint8Array.from(inputBuffer),
processedFile: Uint8Array.from(inputBuffer), // Videos are typically not re-encoded during upload
metadata,
};
} catch (error) {