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

Solved base task #5

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

Conversation

nitorikawashiro
Copy link

No description provided.

@EAndreyF
Copy link

Прошли тесты версии 1

}

if (stats.isFile()) {
fs.readFile(fullpath, function(err, data) {

Choose a reason for hiding this comment

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

эй-эй, ты читаешь весь файл целиком. Смысл в том, чтобы не читать файл целиком, а читать его в потоке.
Не нужно проверять на мультиязычность, в случае нескольких языков нужно переводить из первого кто попался. "catкот" -> "цаткот"


readStream.pipe(transformerStream);
transformerStream.on('data', (chunk) => {
transformed += chunk.toString('utf-8');

Choose a reason for hiding this comment

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

Опять таки ты читаешь весь поток сначала, а потом возвращаешь результат, тебе нужно делать изменения по кусочно, а не читать целиком, иначе теряется весь смысл потоков

transformed += transformerStream.current;
}

res.header('transfer-encoding', 'chunked');

Choose a reason for hiding this comment

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

Если ты будешь делать .pipe(res) то этот хедер у тебя установится автоматически

@@ -1,13 +1,386 @@
'use strict';

Choose a reason for hiding this comment

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

Можешь весь функционал разнести по разным файлам, чтобы было легче читать и понимать что где происходит

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