implemente attachemtn download route
This commit is contained in:
@@ -46,13 +46,14 @@ const serializeAttachment = async (billAttachment: File | null) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
// convert the file contents to a base64 string
|
||||
// convert the billAttachment file contents to format that can be stored in the database
|
||||
const fileContents = await billAttachment.arrayBuffer();
|
||||
const fileContentsBase64 = Buffer.from(fileContents).toString('base64');
|
||||
|
||||
|
||||
// create an object to store the file in the database
|
||||
return({
|
||||
fileName: decodeURIComponent(fileName),
|
||||
fileName,
|
||||
fileSize,
|
||||
fileType,
|
||||
fileLastModified,
|
||||
|
||||
Reference in New Issue
Block a user