Enhancement: File Handling and Compression Support #4

Merged
delorean merged 2 commits from compression into main 2024-02-28 10:23:50 -08:00
Owner

Summary:
This pull request introduces significant enhancements to the file upload functionality, including support for gzip compressed files and improvements to the file handling process in the UploadHandler function. Additionally, it extends the client-side functionality to allow for file compression before upload, leveraging the pako compression library.

Changes:
Server-Side

  • Imported compress/gzip, strings, and bytes packages to support gzip
  • Added isValidGzipHeader function to validate gzip headers in uploaded
  • Modified UploadHandler
  • Buffer file uploads for Decompress gzip files with a .5000 extension if they have a valid gzip
  • Directly handle non-gzip files and provide detailed error
  • Use MIME type detection on processed data to accommodate both compressed and uncompressed files.
  • Improved file writing with os.O_TRUNC to replace contents on upload.

Client-Side Enhancements:

  • Integrated the pako compression library for client-side gzip compression of files before uploading.
  • Updated file selection script to compress files, add a .5000 extension for compressed files, and handle UI feedback.

Testing:

  • Thorough testing is recommended for both compressed and uncompressed file uploads to validate the new functionality.
  • Verify client-side compression results in correctly formatted gzip files. Test Multiple File Types
  • Ensure server-side decompression handles various gzip files correctly and falls back gracefully for non-gzip or corrupt inputs.
  • Confirm that MIME type detection accurately identifies file types post-compression or decompression.

Solves: #3 (comment)

**Summary:** This pull request introduces significant enhancements to the file upload functionality, including support for gzip compressed files and improvements to the file handling process in the UploadHandler function. Additionally, it extends the client-side functionality to allow for file compression before upload, leveraging the pako compression library. **Changes:** _**Server-Side**_ - Imported `compress/gzip`, `strings`, and `bytes` packages to support gzip - Added `isValidGzipHeader` function to validate gzip headers in uploaded - Modified `UploadHandler` - Buffer file uploads for Decompress gzip files with a `.5000` extension if they have a valid gzip - Directly handle non-gzip files and provide detailed error - Use MIME type detection on processed data to accommodate both compressed and uncompressed files. - Improved file writing with `os.O_TRUNC` to replace contents on upload. _**Client-Side Enhancements:**_ - Integrated the `pako` compression library for client-side gzip compression of files before uploading. - Updated file selection script to compress files, add a `.5000` extension for compressed files, and handle UI feedback. **Testing:** - Thorough testing is recommended for both compressed and uncompressed file uploads to validate the new functionality. - Verify client-side compression results in correctly formatted gzip files. _Test Multiple File Types_ - Ensure server-side decompression handles various gzip files correctly and falls back gracefully for non-gzip or corrupt inputs. - Confirm that MIME type detection accurately identifies file types post-compression or decompression. **Solves**: https://git.supernets.org/supernets/hardfiles/issues/3#issue-11_
sad added the
enhancement
label 2024-02-28 05:39:43 -08:00
sad added 1 commit 2024-02-28 05:39:44 -08:00
sad requested review from delorean 2024-02-28 05:39:53 -08:00
sad requested review from acidvegas 2024-02-28 05:39:53 -08:00
Author
Owner

Most affected will be front-end users to try the changes via curl make sure to gzip your file and replace gz with 5000

Most affected will be front-end users to try the changes via curl make sure to gzip your file and replace `gz` with `5000`
sad requested review from hgw 2024-02-28 05:42:31 -08:00
sad added 1 commit 2024-02-28 05:50:17 -08:00
delorean merged commit 439b6bdee9 into main 2024-02-28 10:23:50 -08:00
sad deleted branch compression 2024-02-28 16:40:06 -08:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: supernets/hardfiles#4
No description provided.