title: Superagent .attach() file or buffer data is empty
body: <p>I ran into this issue where superagent does not properly attach a file or a buffer into the request and the reason I mentioned empty is due to the form data looking like :</p>
  
  <pre><code>------WebKitFormBoundaryy6T3XReWRFT1KfFm
  Content-Disposition: form-data; name="media"
  
  
  ------WebKitFormBoundaryy6T3XReWRFT1KfFm--
  </code></pre>
  
  <p>there isnt any information on the file and it comes up as empty <code>media:</code></p>
  
  <p>The code I'm using is simple:</p>
  
  <pre><code>.post(`${API_ROOT}${url}`)
          .withCredentials()
          .attach('media', body.media, 'filename.jpg')
  </code></pre>
  
  <p>Where <code>body.media</code> is:</p>
  
  <pre><code>asBuffer(file, callback) {
      const reader = new FileReader();
      reader.addEventListener('load', () =&gt; callback(reader.result));
      reader.readAsDataURL(file);
  }
  asBuffer(file, ((b) =&gt; {
      body.media = b;
  }));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>body.media = new FormData();
  body.media.append('file', inputFile, inputFileName);
  </code></pre>
  
  <p>or along with after <code>asBuffer</code></p>
  
  <pre><code>Buffer.from(body.media, 'base64');
  </code></pre>
  
  <p>where <code>inputFile</code> is of type <code>File</code>.
  I have also played around with <code>attach</code> and omitted the filename when the <code>body.media</code> was not of type <code>Buffer</code>.</p>
  
  <p>I don't believe there is a problem on my end as using <code>.send(body.media)</code> actually attaches the file to the request formdata and I can see it in the back-end server. Only the <code>.attach()</code> function does not work properly and I need it to as I also need to send fields.</p>
  
  <p>The only workaround I found at this moment was this:</p>
  
  <pre><code>const mediaFile = body.media;
  delete body.media;
  .post(...)
      .withCredentials()
      .query(body)
      .send(mediaFile)
  </code></pre>
  
  <p>and I dont actually feel comfortable getting a huge url just to be able to send a file along with my fields.
  I've seen some issues like this posted already, but none had seem to have an answer.</p>