How does the client use superagent to transmit the binary data of the picture

  node.js, question

Well, on the client side, I used a react component for image clipping and preview, and then the clipped image exists as a binary data stream = >
图片描述

Besides pictures, there are other form data. I want to upload these data asynchronously using superagent, so how do I deal with them? By the way, nodejs is used in the back end.

function dataURLToBlob(dataURL) {
 var BASE64_MARKER = ';  base64,';
 if (dataURL.indexOf(BASE64_MARKER) == -1) {
 var parts = dataURL.split(',');
 var contentType = parts[0].split(':')[1];
 var raw = parts[1];
 
 return new Blob([raw], {type: contentType});
 bracket
 else {
 var parts = dataURL.split(BASE64_MARKER);
 var contentType = parts[0].split(':')[1];
 var raw = window.atob(parts[1]);
 var rawLength = raw.length;
 
 var uInt8Array = new Uint8Array(rawLength);
 
 for (var i = 0;   i < rawLength;  Add I)
 uInt8Array[i] = raw.charCodeAt(i);
 bracket
 
 return new Blob([uInt8Array], {type: contentType});
 bracket
 bracket
 
 
 var form = new FormData();
 Form.append ('file', dataurltobeb ('your base64 string'),' avatar.png');
 Post ('your post address'). send(form).end(function() {
 console.log(arguments);
 });