Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Purge temp files #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
);
Expand Down