We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
最后一句res.end("hello world") 导致页面图片不出现 原因: end会触发write的如果参数为data(buffer chunk or string utf-8) end为阻塞操作,pipe为无阻塞操作,所以优先执行end,end终结了一次请求的完整过程,所以导致图片不出现 如果图片src为undefined 就会默认请求当前页面链接
The text was updated successfully, but these errors were encountered:
创建此Server后,用户访问请求过来,Server会创建一个可读流,当调用.pipe(res)为可读流指定目标后,可读流(stream)会开始从文件中读取数据,数据写入res(可写流)完毕后,自动调用res的end()方法,结束响应,可写流不再写入。
Sorry, something went wrong.
可写流重要的两个方法:write和end
write:该方法向底层系统写入数据,并在数据被处理完毕后调用所给的回调。 end:当不再写入数据时,调用该方法,停止写入。
在调用end()后,再调用write()方法会产生错误。
No branches or pull requests
最后一句res.end("hello world") 导致页面图片不出现
原因:
end会触发write的如果参数为data(buffer chunk or string utf-8)
end为阻塞操作,pipe为无阻塞操作,所以优先执行end,end终结了一次请求的完整过程,所以导致图片不出现
如果图片src为undefined
就会默认请求当前页面链接
The text was updated successfully, but these errors were encountered: