17 lines
403 B
TypeScript
17 lines
403 B
TypeScript
import { blobToBase64 } from "./blob-to-base64";
|
|
|
|
export const generateFileInfo = async (blobInfo: {
|
|
blob: () => Blob;
|
|
filename: () => string;
|
|
}) => {
|
|
const blob = blobInfo.blob();
|
|
const base64 = await blobToBase64(blob);
|
|
return {
|
|
fieldName: `${blob.type.split("/")[1]}`,
|
|
fileType: blob.type,
|
|
fileBase64: base64,
|
|
originalName: blobInfo.filename(),
|
|
size: blob.size,
|
|
};
|
|
};
|