How to handle ajax/http-post request (responsetype: arraybuffer) using nodejs+express in the backend

人盡茶涼 提交于 2019-12-02 03:57:21

The bodyParser middleware does not parse POSTed binary data. When i tried base64 encoded strings, it would show up as the object name in a JSON object, something like {"data":}, obviously expecting POST-data in the form name=value.

There might be a middleware that deals with binary data, or you can access the raw data by binding to the "data" event and stack the received chunks into a buffer using the method described in the ProtocolBuffers.js wiki.

This is using the vanilla http module without express, but should work anyway.

I don't know about arraybuffer but usually, we can access the POST data using the req.body parameter. Does that work for you?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!