expressjs / expressjs/multer

Modify files before storing them

Open
#211 9 comments 3 reactions 0 assignees View on GitHub
discuss
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

It 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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.