-
Notifications
You must be signed in to change notification settings - Fork 200
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
Solution #133
base: master
Are you sure you want to change the base?
Solution #133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the server and handling file compression! 🎉 While there are a few minor issues, such as ensuring proper response termination in error handling and accessing variables correctly, these do not critically impact the functionality. Keep up the good work and consider the suggested improvements for future enhancements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
const fileName = uploadedFile[0].originalFilename; | ||
const filePath = uploadedFile[0].filepath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The uploadedFile
is accessed as an array, but it should be an object. Ensure that uploadedFile.originalFilename
and uploadedFile.filepath
are accessed directly without indexing.
const filePath = uploadedFile[0].filepath; | ||
const fileStream = fs.createReadStream(filePath); | ||
|
||
const compressedStream = getCompressedFile(compressionType[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compressionType
is accessed as an array, but it should be a string. Ensure that compressionType
is used directly without indexing.
fileStream.on('error', () => { | ||
res.statusCode = 500; | ||
res.end('Server Error'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding res.end()
after setting the status code and message in the error handler to ensure the response is properly terminated in case of an error.
Solution