-
-
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
文件下载如何设置? #965
Labels
Comments
丢到public目录即可。不用自己写。 |
@GeneralFy 你是不是浏览器的问题? 我无法复现,是可以直接下载的,chrome。 另外你的代码可以精简下: app.get('/download', function* () {
const ctx = this;
ctx.status = 200;
ctx.body = { a: 'b' };
ctx.set('content-type', 'application/octet-stream');
ctx.set('content-disposition', 'attachment; filename=test.json');
}); |
谢谢大家 问题我找到了 我是ajax发请求去下载文件 |
.... |
这个也可以做 我现在是异步问题不知道怎么处理 |
我可以写成一个example放到eggs/example么? |
欢迎 |
eggjs/examples#28 这个咯, 有问题请告诉我。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
代码是这样写的,但是浏览器响应的是json串,不是一个文件,请问该如何解除
The text was updated successfully, but these errors were encountered: