Skip to content

Implement compression app server with streams and zlib#203

Open
S-Khraban wants to merge 1 commit intomate-academy:masterfrom
S-Khraban:develop
Open

Implement compression app server with streams and zlib#203
S-Khraban wants to merge 1 commit intomate-academy:masterfrom
S-Khraban:develop

Conversation

@S-Khraban
Copy link

No description provided.

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.

Review Summary

Great job on this submission! Your server implementation is very well-structured, and you've done an excellent job with routing, error handling, and using streams with the zlib module.

I am approving this solution for educational purposes so you can move forward, but there is one small detail to correct. In src/createServer.js, the compressed file's extension doesn't quite match the requirements. Your code creates filenames like file.txt.gzip, but the task specifies the extension should be .gz for gzip and .dfl for deflate.

A good way to fix this would be to create a simple map or object that links the compression type string (e.g., 'gzip') to its required file extension (e.g., 'gz'). You can then use this map to build the correct filename for the Content-Disposition header.

This is a great learning opportunity about watching for those small but important details in specifications. Keep up the fantastic work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example


res.setHeader(
'Content-Disposition',
`attachment; filename=${filename}.${compressionType}`,

Choose a reason for hiding this comment

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

The task description specifies the file extensions should be .gz for gzip and .dfl for deflate. Your current implementation uses the full compression type name, resulting in extensions like .gzip and .deflate. You'll need to map the compression type to the correct extension.

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