Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sftp-fs-kt

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sftp-fs-kt

Make it simple to implement a SFTP server by implementing a FS interface class

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Description

sftp-fs is intended to allow for easy implementation of a SFTP server where the server file system can be anything. You can implement an ordinary file system as is done in FileSystem.js. But for any other type of filesystem-like backends you can just extend the FileSystemInterface class and do something cool.

Technical stuff

Is built ontop of ssh2 as most SSH stuff in node.js is. I have elected to use yarn for this project but using npm will work just as well.

Running tests

# Install dependencies
$ yarn
...

# Run eslint tests
$ yarn lint
...

# Run unit tests
$ yarn test
...

Examples

Starting the standard file serving SFTP server

# Install dependencies
$ yarn
...

# Start server (Note: Can take arguments, check the code)
# Default password is 'SuPerSeCrReT'
$ yarn server
...

Implementing the FileSystemInterface

"use strict";

const { FileSystemInterface, Server } = require("sftp-fs");

class MyFS extends FileSystemInterface {
    // TODO: Implement the methods that are needed
}

const keyFile = "./id_rsa";
const port = 8022;
const server = new Server(new MyFS());

process.on("SIGINT", () => server.stop());

const run = async () => {
    server.on("client-connected", () => console.log("Client connected!"));
    server.on("client-disconnected", () => console.log("Client disconnected!"));
    server.on("error", (error) => console.error(error));

    await server.start(keyFile, port);
};

run();

Keywords

FAQs

Package last updated on 03 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc