Socket
Socket
Sign inDemoInstall

automatedsftpsender

Package Overview
Dependencies
22
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    automatedsftpsender

Automated SFTP Sender (File Watch)


Version published
Weekly downloads
7
Maintainers
1
Install size
1.47 MB
Created
Weekly downloads
 

Readme

Source

AutomatedSFTPSender

Watches your project folder, and sends changes to server via SFTP.

Methods

  • constructor(connectConfig: ConnectConfig, remotePath: string)

ConnectConfig: See https://github.com/mscdex/ssh2#client-methods connect(< object >config)

remotePath: the server folder path where you want to synchronize with your project folder


  • connect()

connects to server

  • watch(watchPath: string, options?: chokidar.WatchOptions)

watchPath: your project folder where you want to synchronize with the server folder

options?: see https://github.com/paulmillr/chokidar#api options


starts watching your project folder.

  • upload (clientPath: string, serverPath: string)
  • delete (serverPath: string)
  • mkdir (serverPath: string)
  • rmdir (serverPath: string)

clientPath: path of your project file

serverPath: path where your project file goes | path of the server file / folder that will be created / deleted


these methods will be executed when your project files change, but you can also execute directly.

  • setFilter (filter: (filePath: string, type: string) => boolean)

filter: filter function

type: event type (add|change|unlink|addDir|unlinkDir)


Filters whether your changed files will be sent to server or not. (true: send, false: ignore)

Examples

import AutomatedSFTPSender from 'automatedsftpsender'
import path from 'path'

const sender = new AutomatedSFTPSender({
  host: 'example.com', // Your server host
  port: 22, // SFTP port
  username: 'admin',
  password: 'admin'
}, '/root/server/build') // where your project file will be synchronized

sender.connect() // connects to server
sender.watch(path.resolve(__dirname, 'build'), { // ./build/ folder will be synchronized
  ignoreInitial: true // ignores initial detection. if false, error can be thrown
})

Keywords

FAQs

Last updated on 05 Aug 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc