-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: master
Are you sure you want to change the base?
Conversation
Прошли тесты версии 1 |
} | ||
|
||
if (stats.isFile()) { | ||
fs.readFile(fullpath, function(err, data) { |
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.
эй-эй, ты читаешь весь файл целиком. Смысл в том, чтобы не читать файл целиком, а читать его в потоке.
Не нужно проверять на мультиязычность, в случае нескольких языков нужно переводить из первого кто попался. "catкот" -> "цаткот"
|
||
readStream.pipe(transformerStream); | ||
transformerStream.on('data', (chunk) => { | ||
transformed += chunk.toString('utf-8'); |
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.
Опять таки ты читаешь весь поток сначала, а потом возвращаешь результат, тебе нужно делать изменения по кусочно, а не читать целиком, иначе теряется весь смысл потоков
transformed += transformerStream.current; | ||
} | ||
|
||
res.header('transfer-encoding', 'chunked'); |
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.
Если ты будешь делать .pipe(res) то этот хедер у тебя установится автоматически
@@ -1,13 +1,386 @@ | |||
'use strict'; |
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.
Можешь весь функционал разнести по разным файлам, чтобы было легче читать и понимать что где происходит
No description provided.