Modify files before storing them
See original GitHub issueIt would be useful to have the ability to modify files as they are uploaded. A simple example would be resizing an image using gd
.
My initial thoughts are the fileFilter
function could return the file as the second argument rather than a boolean. That way it could be manipulated in the fileFilter
function and then be passed on to be stored, or dropped if false was passed instead of the file.
https://github.com/expressjs/multer/blob/master/lib/make-middleware.js#L94
This would be more useful when using an external storage engine such as S3
as you wouldn’t have to upload -> download -> edit -> re-upload
.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:9 (7 by maintainers)
Top Results From Across the Web
View and modify files and folders in Files on iPhone
Browse and open files and folders · Tap Browse at the bottom of the screen, then tap an item on the Browse screen....
Read more >ruby on rails - active storage - how to modify file and resave it
I am trying to modify uploaded file once it is uploaded but I want to modify it (e.g. do some imagemagick operations on...
Read more >Best Practice: Organizing Video Files for Editing - FXhome
Cloud Storage can be a good backup option you can access online from anywhere. Often best for use during a project to transfer...
Read more >Change the default storage location for backup files
Click File > Options > Save & Backup. Under Save, in the Paths list, click Backup Folder, and then click Modify. In the...
Read more >Editing settings for your SMB file share - AWS Storage Gateway
You cannot edit an existing file share to point to a new bucket or access point, or to modify the VPC endpoint settings....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wesleytodd Maybe it’s better to make the transformFile option belong on the global multer instance? That way we don’t have to implement it in every storage module.
Also, I think that
transformFile
should be a function that takes(req, file, cb)
that calls thecb
with a replacement streamCurrent PR that would allow this is https://github.com/expressjs/multer/pull/399