1.1.2 • Published 3 years ago

ssh2-sftp-server v1.1.2

Weekly downloads
47
License
MIT
Repository
github
Last release
3 years ago

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

1.1.2

3 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago