title: How do I stream large files over ssh in Node?
body: <p>I'm trying to stream a cat command using the ssh2 module but it just hangs at some point of the execution. I'm executing <code>cat there.txt</code> where there.txt is around 10 MB or so.</p>
  
  <p>For example:</p>
  
  <pre><code>local = fs.createWriteStream('here.txt');
  conn.exec('cat there.txt', function(err, stream) {
       if (err) throw err;
       stream.pipe(local).on('finish, function() { console.log('Done'); });
  }
  </code></pre>
  
  <p>This just completely stops at one point. I've even piped the stream to local stdout, and it just hangs after a while. In my actual code, I pipe it through a bunch of other transform streams so I think this is better than transferring the files to the local system first (the files may get larger than 200MB).</p>