uploadthing
uploadthing copied to clipboard
feat: expose `waitUntil` for Next.js adapter
Describe the feature you'd like to request
https://vercel.com/docs/functions/functions-api-reference#waituntil
I think itβd be useful to have this exposed in the onUploadComplete callback, since you could do some stuff non-blocking (such as delete an old image for example) without blocking server polling response times
Describe the solution you'd like to see
.onUploadComplete(async ({ file, metadata, ctx }) => {
await db.update(...)
// delete old file non-blocking
ctx.waitUntil(() => {
utapi.deleteFile(metadata.oldFileKey)
})
})
Additional information
No response
π¨βπ§βπ¦ Contributing
- [X] πββοΈ Yes, I'd be down to file a PR implementing this feature!
I can work in this