I have several problems, first one I have to save in my mariadb an information from a PDF, I have been using libraries or trying with JS native to extract it and save it but its imposible. My project is a NEXT.js v14 but I compile with bun, its "similar" but not the same, because when I tried to download parsePdf it happened the message "Module not found: Can't resolve 'fs'"
I have been watching how to solve the problem with webpack 4-5 but not with bun. For this problem the only solution I thought is create a micro service for this until the fs modulo wont be a problem
const arrayBufferToBuffer = (arrayBuffer) => {
return Buffer.from(new Uint8Array(arrayBuffer));
};
const insertBlobData = async (files, attachmentID, userId) => {
try { const fileList = Array.isArray(files) ? files : [files];
const fileRequests = fileList.map((file) => {
const fileData = {
blobID: generateUUID(),
attachmentID,
name: file.name,
extension: 'pdf',
data: arrayBufferToBuffer(file.data), // Convertimos el ArrayBuffer a Buffer
createdBy: userId.providerID,
createdAt: sqlFormattedDate(new Date()),
updatedBy: null,
updatedAt: null,
erasedBy: null,
erasedAt: null,
};
savedata ETC
}}