title: Assigning a name to a file being uploaded from buffer in ssh2-sftp-client?
body: <p>I'm having difficulties to upload a file from buffer via ssh2-sftp-client (<a href="https://www.npmjs.com/package/ssh2-sftp-client" rel="noreferrer">https://www.npmjs.com/package/ssh2-sftp-client</a>) 
  I'm using Multer for uploading files, then I'm just targeting <code>req.file.buffer</code> to access the data to be uploaded via the sftp client like this: </p>
  
  <pre><code>sftp.connect({
  host: 'some.IP.address.here',
  port: '22',
  username: 'username',
  password: 'password'
  })
  .then(() =&gt; {
  return sftp.put(req.file.buffer, '/var/www/bucket', false);
  })
  .catch((err) =&gt; {
  console.log(err, 'catch error');
  });
  </code></pre>
  
  <p>I'm not able to figure out how to assign a name to that uploaded file which is stored in <code>req.file.originalname</code>  of the Multer object.</p>
  
  <p>Btw, the ssh2-sftp-client returns following error:</p>
  
  <p><code>Error: Failure
  image.routes.js:39
  code:4
  lang:""
  message:"Failure"
  stack:"Error: Failure\n    at SFTPStream._transform (/Users/petrfila/Apps/lifeIQ/liq-api/node_modules/ssh2-streams/lib/sftp.js:410:27)\n    at SFTPStream.Transform._read (_stream_transform.js:185:10)\n    at SFTPStream._read (/Users/petrfila/Apps/lifeIQ/liq-api/node_modules/ssh2-streams/lib/sftp.js:181:15)\n    at SFTPStream.Transform._write (_stream_transform.js:173:12)\n    at doWrite (_stream_writable.js:406:12)\n    at writeOrBuffer (_stream_writable.js:392:5)\n    at SFTPStream.Writable.write (_stream_writable.js:290:11)\n    at Channel.ondata (_stream_readable.js:646:20)\n    at Channel.emit (events.js:127:13)\n    at addChunk (_stream_readable.js:269:12)\n    at readableAddChunk (_stream_readable.js:256:11)\n    at Channel.Readable.push (_stream_readable.js:213:10)\n    at SSH2Stream.&lt;anonymous&gt; (/Users/petrfila/Apps/lifeIQ/liq-api/node_modules/ssh2/lib/Channel.js:166:15)\n    at SSH2Stream.emit (events.js:127:13)\n    at parsePacket (/Users/petrfila/Apps/lifeIQ/liq-api/node_modules/ssh2-streams/lib/ssh.js:3444:10)\n    at ...
  __proto__:Object {constructor: , name: "Error", message: "", …}
  constructor:function Error() { … }
  message:""
  name:"Error"
  toString:function toString() { … }
  __proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
  catch error</code></p>