ssh2-sftp-server

1.1.2 • Public • Published

ssh2-sftp-server : SFTP server for node.js

Works in win32 and linux style.

ssh2-sftp-server is sftp server module written in pure JavaScript it use excellent ssh2 library by Brian White.

Build Status Version

License Code style

Available platform Available platform

Installation

npm install ssh2-sftp-server

Supported API

support most of client requests:

  • OPEN
  • CLOSE
  • REALPATH
  • STAT
  • OPENDIR
  • READ
  • REMOVE
  • RMDIR
  • MKDIR
  • RENAME
  • READDIR
  • WRITE

Usage

"use strict";

const fs         = require('fs');
const {Server}   = require('ssh2');
const SftpServer = require('ssh2-sftp-server');

new ssh2.Server({
  hostKeys: [fs.readFileSync('host.key')]
}, function(client) {
  client.on('authentication', function(ctx) {
    ctx.accept();
  }).on('ready', function() {
    client.on('session', (accept) => {
      let session = accept();
      session.on('sftp', function() {
        var sftpStream = accept();
        new SftpServer(sftpStream);
      });
    });
  });
});

Credits

Readme

Keywords

Package Sidebar

Install

npm i ssh2-sftp-server

Weekly Downloads

16

Version

1.1.2

License

MIT

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • 131
  • idjem
  • frodon