-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[建议]让ctx.getFileStream 支持bytesRead #2860
Comments
Translation of this issue: [Recommended] Let FileStream support bytesReadAccording to [getFileStream example] (http://mirror.eggjs.org/zh-cn/basics/controller.html) Example of bytesRead access:
Although rs.bytesRead can be obtained through the bytesWritten of ws/ps, ** but the incomplete object properties will be confusing to the user**. (For example, I misused FileStream.bytesRead and debugged it for a long time) Will you support bytesRead in the future? |
这个本来就不是文件 io,为何以 FileStream 为准,可以去 https://github.com/nodejs/node 问是否支持。 |
@popomore 这个不是node 的FileStream, 而是busboy 的FileStream。 我发到busboy 这里了 mscdex/busboy#173 |
直接给那边提个 PR 吧 |
其实不需要也行的,你可以监听 data 事件,就知道了。 |
其实这个属性可有可无吧。只是有则完备一些吧。 我上面的实例应该是目前最简单的方案了吧。 |
根据 getFileStream 示例
我们在使用egg 上传文件时,使用的是busboy 的FileStream(ReadableStream) 而不是fs 的ReadStream.
所以FileStream 缺少bytesRead.
bytesRead 访问示例:
虽然通过ws/ps 的bytesWritten 可以得到rs.bytesRead,
但是对象属性不完整会给用户带来困惑。(比如我误用FileStream.bytesRead 而调试了很久)
The text was updated successfully, but these errors were encountered: