mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 09:25:08 +10:00
feat: document file conversion
This commit is contained in:
@@ -44,10 +44,18 @@ export const putPdfFileServerSide = async (file: File) => {
|
||||
return await createDocumentData({ type, data });
|
||||
};
|
||||
|
||||
type PutNormalizedPdfOptions = {
|
||||
file: File;
|
||||
originalMimeType?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Uploads a pdf file and normalizes it.
|
||||
*/
|
||||
export const putNormalizedPdfFileServerSide = async (file: File) => {
|
||||
export const putNormalizedPdfFileServerSide = async ({
|
||||
file,
|
||||
originalMimeType,
|
||||
}: PutNormalizedPdfOptions) => {
|
||||
const buffer = Buffer.from(await file.arrayBuffer());
|
||||
|
||||
const normalized = await normalizePdf(buffer);
|
||||
@@ -63,6 +71,7 @@ export const putNormalizedPdfFileServerSide = async (file: File) => {
|
||||
return await createDocumentData({
|
||||
type: documentData.type,
|
||||
data: documentData.data,
|
||||
originalMimeType,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user