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

Solution #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #133

wants to merge 1 commit into from

Conversation

ab3MN
Copy link

@ab3MN ab3MN commented Dec 5, 2024

Solution

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Comment on lines +46 to +47
const fileName = uploadedFile[0].originalFilename;
const filePath = uploadedFile[0].filepath;

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]);

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.

Comment on lines +14 to +17
fileStream.on('error', () => {
res.statusCode = 500;
res.end('Server Error');
});

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.

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