Skip to content

feat(s3): stream s3 content over a zip file #822

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

Merged
merged 3 commits into from
May 4, 2025

Conversation

thereis
Copy link
Contributor

@thereis thereis commented Apr 24, 2025

Overview

This pull request introduces several enhancements and fixes across the backend and frontend of the project. The most significant changes include implementing ZIP file generation for S3 storage, adding a custom exception filter for streaming responses, updating the frontend to display file count and size information, and improving code formatting with Prettier configuration.

Screenshot

image

Video

pr-stream-zip.mp4

Below is a categorized summary of the key changes:

Backend Enhancements

  • ZIP File Support for S3: Added a getZip method in S3FileService to generate ZIP files for files stored in S3. This method streams files from S3, compresses them using the archiver library, and handles errors gracefully.
  • Custom Exception Filter: Introduced StreamResponseFilter to handle exceptions during streaming. If headers are already sent, the filter logs the error and terminates the stream; otherwise, it sends a JSON error response.
  • Controller Updates: Applied the StreamResponseFilter to the getZip endpoint in FileController and updated the method to handle asynchronous ZIP file generation.

Frontend Updates

  • File Count and Size Display: Enhanced the share page to show the total number of files and their combined size using a new i18n key (share.fileCount) and the byteToHumanSizeString utility.

thereis added 2 commits May 1, 2025 23:16
…proved file handling

- Deleted StreamResponseFilter as it was no longer needed.
- Updated getZip method in LocalFileService to return a Promise and handle errors more effectively.
- Adjusted getZip method in FileService to await the storage service's getZip call.
Copy link
Owner

@stonith404 stonith404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@stonith404 stonith404 merged commit ccc783a into stonith404:main May 4, 2025
1 check passed
@thereis thereis deleted the feat/add-s3-zip-stream branch May 12, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants