resolved type errors and other proc. app build error
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user