title: Can you use the node package ssh2 in a browser?
body: <p>I am building an SFTP client in my browser for school.  I am using the node package ssh2 and am able to get my code to work in the terminal.  I can use the code to connect and read the directories and files in that server.  However, I am unable to execute the code through an HTML partial in my browser.  I am receiving the error "binding is not supported".
  I am using angular and browserify.  Because the ssh2 package is server-side, I had to use browserify in order to "require" it at the top of my JavaScript files where needed.
  Has anyone ever used the ssh2 package inside of their browser?  I'm thinking that the binding error message is telling me that this package will only work in the terminal, but I wanted to be certain.  Here is my code...</p>
  
  <p>controller:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"use strict";
  
  module.exports = function($scope) {
  
   $scope.connect = function(){
    let Client = require('../../lib/node_modules/ssh2-sftp-client');
    let sftp = new Client();
    sftp.connect({
        host: 'test.rebex.net',
        port: '22',
        username: 'user',
        password: 'password'
    }).then(() =&gt; {
     var remoteServerFolders = sftp.list('/');
     console.log("remoteServerFolders", remoteServerFolders);
        return remoteServerFolders;
    }).then((data) =&gt; {
        console.log('the data info', data);
        sftp.end();
    }).catch((err) =&gt; {
        console.log('catch error', err);
    });
   };
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>app.js:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"use strict";
  
  let angular = require("../lib/node_modules/angular/");
  let app = angular.module("SftpApp", ['ngRoute']);
  
  require("../lib/node_modules/angular-route/angular-route.min.js");
  
  require("./factories/");
  require("./controllers/");
  
  app.config(function($routeProvider){
   $routeProvider.
   when('/', {
    templateUrl: 'partials/connect.html',
    controller:"ConnectingCtrl"
   });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h1&gt;Connect to an SFTP server&lt;/h1&gt;
  
  &lt;div ng-controller="ConnectingCtrl"&gt;
   &lt;button type="button" class="btn btn-default" ng-click="connect()"&gt;Connect&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>