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
先看这个代码
ctx.attachment(path.parse(filename).base) ctx.set('Content-Type', 'application/octet-stream') ctx.set('Content-Length', stat.size) ctx.body = fs.createReadStream(filePath)
在Windows上面能够正常下载文件,没什么问题。
然后我同样的代码再Ubuntu上面,body的值就变成了stream对象的json形式。每个文件的内容都是这个stream对象
{ "_readableState": { "objectMode": false, "highWaterMark": 65536, "buffer": { "head": null, "tail": null, "length": 0 }, "length": 0, "pipes": [], "flowing": null, "ended": false, "endEmitted": false, "reading": false, "sync": true, "needReadable": false, "emittedReadable": false, "readableListening": false, "resumeScheduled": false, "errorEmitted": false, "emitClose": true, "autoDestroy": false, "destroyed": false, "errored": null, "closed": false, "closeEmitted": false, "defaultEncoding": "utf8", "awaitDrainWriters": null, "multiAwaitDrain": false, "readingMore": false, "dataEmitted": false, "decoder": null, "encoding": null }, "_events": {}, "_eventsCount": 2, "path": "/js/app.9e78b476.js", "fd": null, "flags": "r", "mode": 438, "end": null, "autoClose": true, "bytesRead": 0, "closed": false }
The text was updated successfully, but these errors were encountered:
Hello @norsl. Please provide a reproducible example following the instruction.
Issues labeled by Need Reproduce will be closed if no activities in 7 days.
Need Reproduce
@norsl,请根据这个说明提供最小可复现代码。
如果在 7 天内没有进展会被自动关闭。
Sorry, something went wrong.
找到问题根源了,被自己蠢哭了
用了gzip中间件。但是这个gzip我并没有写完,导致body被JSON.stringify掉了。
No branches or pull requests
先看这个代码
在Windows上面能够正常下载文件,没什么问题。
然后我同样的代码再Ubuntu上面,body的值就变成了stream对象的json形式。每个文件的内容都是这个stream对象
The text was updated successfully, but these errors were encountered: