worksmith_sftp

0.2.2 • Public • Published

worksmith_sftp

SFTP activities for worksmith

This package contains the following activities/tasks:

name description
connect Connects the underlying sftp client
disconnect Disconnects the underlying sftp client
command Executes the specified sftp command

connect-activity activity

Connects the underlying sftp client

params
name type description
config object Connection parameters (see whoosh)
example
var worksmith = require('worksmith')
worksmith.use('sftp', require('worksmith_sftp'))
var workflow = worksmith({task:'sequence', items : [{
    task:'sftp/connect',
    config: {
        hostname: 'sftp.example.com',
        port: 22,
        username: 'fred',
        password: 'secret'
    },
    resultTo: 'sftp'
}])

disconnect activity

Disconnects the underlying sftp client

params
name type description
sftp sftp client The sftp client (if not specified expected to be in the context 'sftp' property)
example
var worksmith = require('worksmith')
worksmith.use('sftp', require('worksmith_sftp'))
var workflow = worksmith({task:'sequence', items : [{
    task:'sftp/connect',
    config: {
        hostname: 'sftp.example.com',
        port: 22,
        username: 'fred',
        password: 'secret'
    },
    resultTo: 'sftp'
}, {
    task: 'sftp/disconnect',
    sftp: '@sftp'
}])

command activity

Executes the specified sftp command

params
name type description
sftp sftp client The sftp client (if not specified expected to be in the context 'sftp' property)
command string The command to execute (see whoosh)
arguments array The array of parameters to pass to the command
example
var worksmith = require('worksmith')
worksmith.use('sftp', require('worksmith_sftp'))
var workflow = worksmith({task:'sequence', items : [{
    task:'sftp/connect',
    config: {
        hostname: 'sftp.example.com',
        port: 22,
        username: 'fred',
        password: 'secret'
    },
    resultTo: 'sftp'
}, {
    task: 'sftp/command',
    command: 'stat',
    arguments: ['.']
}, {
    task: 'sftp/disconnect',
    sftp: '@sftp'
}])

Running tests

You need an sftp server running on localhost:10022 for the tests to pass. If you have docker and docker-compose installed simply run docker-compose up in the route of this project.

Package Sidebar

Install

npm i worksmith_sftp

Weekly Downloads

3

Version

0.2.2

License

MIT

Last publish

Collaborators

  • guidesmiths_bot
  • feliun
  • ulisesgascon
  • cressie176