ssh2-sftp-server
v1.1.2
Published
SSH2 sftp server
Downloads
56
Readme
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.
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);
});
});
});
});