用JSON从后端返回许多文件
我想知道,我可以使用许多文件(带有应用程序/八位字节)回复后端控制器的客户端。如果我使用JSON数据响应一系列文件(例如:用户数据(昵称,电子邮件)以及他的图像收集以相同的响应中),情况会更好。 因此,Frontend可以将JSON +几个文件发送到后端。我可以做同样的事情吗?
经过研究,我只发现有关响应应用程序\ JSON的机会和唯一的文件(在不同的请求和响应中)的信息。
我使用Nestjs。 Nestjs包装Multer Lib来处理Multipart \ Form-Data。
当然,有可以将base64用于文件的方法,但是我发现文件的更好方法是使用内容类型。
I want to know may i respond to client from backend controller with many files (with application/octet-stream). It will be more better, if i respond array of files with json data (for example: user data (nickname, email) with his collection of images in the same response).
So frontend can send json + several files to backend. Can i do the same thing back?
After research i found only information about opportunities to respond application\json and the only file separately (in different requests and responces).
I use nestjs. Nestjs wraps multer lib for handling multipart\form-data.
Of course, there is way to use base64 for files, but i found that better way for files is to use content-type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论