Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade multer dependency so we can leverage streams #349

Open
rglover opened this issue Oct 1, 2023 · 2 comments
Open

Upgrade multer dependency so we can leverage streams #349

rglover opened this issue Oct 1, 2023 · 2 comments
Assignees
Labels
@joystick.js/node Related to the @joystick.js/node package. refactor Something to improve
Projects

Comments

@rglover
Copy link
Contributor

rglover commented Oct 1, 2023

Noticed that uploads can be slow and after digging found out that the latest version of Multer switched to using streams for uploads. Just need to refactor the uploads API and make sure we keep the shape of the returned data consistent (e.g., req.file or req.files still exists).

Another option is to just use Busboy directly (the core dependency Multer uses to parse uploads). Technically we don't need a bunch of fancy features—we just want the file data.

@rglover rglover added refactor Something to improve @joystick.js/node Related to the @joystick.js/node package. labels Oct 1, 2023
@rglover rglover self-assigned this Oct 1, 2023
@rglover
Copy link
Contributor Author

rglover commented Oct 1, 2023

Just did a test. Only "gotcha" is making sure we handle the write to disk from the stream for local uploads and then pass the stream off to S3 for uploads there: https://stackoverflow.com/questions/37336050/pipe-a-stream-to-s3-upload.

@rglover
Copy link
Contributor Author

rglover commented Oct 1, 2023

Got it. See examples in your /cheatcode/experiments/multer2 directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@joystick.js/node Related to the @joystick.js/node package. refactor Something to improve
Projects
1.0.0
Awaiting triage
Development

No branches or pull requests

1 participant