title: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object
body: <p>1) I am trying to decode a GET request something like this <strong>abb197313b83ad9f16a946c8be35a0f8</strong> but I am getting this error. </p>
  
  <p><em>TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.</em></p>
  
  <pre><code>let decoder;
  
      const parseMetadataString = (metadata_string) =&gt; {
      const kv_pair_list = metadata_string.split(',');
  
      return kv_pair_list.reduce((metadata, kv_pair) =&gt; {
          const [key, base64_value] = kv_pair.split(' ');
  
          metadata[key] = {
              encoded: base64_value,
              decoded: Buffer.from(base64_value, 'base64').toString('ascii'),
          };
          return decoder = metadata;
      }, {});
  }
  
    app.get('/upload/files/:fileid', (req, res) =&gt; {
     const { fileid } = req.params;
     parseMetadataString(fileid);
     res.sendFile(__dirname + /files/ + decoder);
    });
  </code></pre>
  
  <p>2) If I do it this way I get this error:</p>
  
  <p><em>TypeError: Cannot read property 'name' of undefined</em></p>
  
  <p>But it does res.sendFile with the correct name.</p>
  
  <pre><code>let decoder;
  
    const parseMetadataString = (metadata_string) =&gt; {
      const kv_pair_list = metadata_string.split(',');
  
      return kv_pair_list.reduce((metadata, kv_pair) =&gt; {
          const [key, base64_value] = kv_pair.split(' ');
  
          metadata[key] = {
              encoded: base64_value,
              decoded: Buffer.from(base64_value, 'base64').toString('ascii'),
          };
          return decoder = metadata;
      }, {});
  }
  
    app.get('/upload/files/:fileid', (req, res) =&gt; {
     const { fileid } = req.params;
     res.sendFile(__dirname + /files/ + decoder.name.decoded);
  });
  
   server.on(EVENTS.EVENT_UPLOAD_COMPLETE, (event) =&gt; {
     parseMetadataString(event.file.upload_metadata);
   });
  </code></pre>