FEAT: add svg

This commit is contained in:
marcos-silva-rodrigues
2025-01-30 16:06:13 -03:00
parent db78494b1a
commit 867aec092b
2 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -96,11 +96,18 @@ export class ThemeService implements OnModuleInit {
private async sendFile(file: Express.Multer.File, stream$: ReplaySubject<ThemeRequest>) {
const chunkSize = 4 * 1024 * 1024;
const bufferStream = new CustomBufferStream(file.buffer, chunkSize);
const parseMimitypeForExtension = {
'image/jpeg': '.jpeg',
'image/jpg': '.jpg',
'image/png': '.png',
'image/svg+xml': '.svg',
}
const extension = parseMimitypeForExtension[file.mimetype];
return new Promise((resolve, reject) => {
bufferStream.on('data', (chunk) => {
const mimetype = file.mimetype.split('/')[1]; // example image/jpeg
const filename = file.fieldname.concat(".", mimetype);
const filename = file.fieldname.concat(extension);
stream$.next({
customerId: '',
displayName: '',