richardgirges / express-fileupload

Simple express file upload middleware that wraps around busboy
MIT License
1.52k stars 259 forks source link

How can I use this to not clean up temp files? #351

Closed JemiloII closed 9 months ago

JemiloII commented 1 year ago

I want to just use tmp files to save directly to a folder so I'm not wasting resources moving files. I'm already using another middleware for security to check the recipient that I trust. having to do file.mv is pretty dumb.

RomanBurunkov commented 10 months ago

You can set tempFileDir to the target folder and than rename files if you need original names.

RomanBurunkov commented 9 months ago

file.mv method uses fs.rename. So if you set tempFileDir to the target folder, middleware will put files there and only renaming will be done.