From d1dd8bb1585ae47dcb8dc2bf4de1b39af19390ad Mon Sep 17 00:00:00 2001 From: Joshua Dechant Date: Mon, 28 Feb 2022 11:52:18 -0500 Subject: [PATCH 1/2] increase upload limit --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 28fbc41..fc5e98e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,7 +21,7 @@ async function createHttpServer(app: Express) { app.use(bodyParser.json()); app.use( fileUpload({ - limits: { fileSize: 30 * 1024 * 1024 }, // 30MB + limits: { fileSize: 100 * 1024 * 1024 }, // 100MB useTempFiles: true }) ); From eed268fb1d89260c808d6cae61e70cd73a7f9c02 Mon Sep 17 00:00:00 2001 From: Joshua Dechant Date: Mon, 28 Feb 2022 11:52:35 -0500 Subject: [PATCH 2/2] purge temp files after processing --- src/handlers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/handlers.ts b/src/handlers.ts index f2a0bc6..9088692 100644 --- a/src/handlers.ts +++ b/src/handlers.ts @@ -16,6 +16,7 @@ export async function handleIpfsFileUpload( try { const content = await ipfsProvider.uploadFile(file.tempFilePath); + await fs.unlink(file.tempFilePath, () => null); return res.status(200).json(content); } catch (e) { console.log(e); @@ -37,6 +38,7 @@ export async function handleIpfsImageWithThumbnailUpload( try { const content = await ipfsProvider.uploadImageWithThumbnail(file.tempFilePath); + await fs.unlink(file.tempFilePath, () => null); return res.status(200).json(content); } catch (e) { console.log(e);