@wenbo/virtual-sftp
Synchronize files and folders from different locations and send them over sftp/ssh to a new location inside an basedir.
Last updated 2 months ago by chumahtung .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @wenbo/virtual-sftp 
SYNC missed versions from official npm registry.

virtual-sftp

Synchronize files and folders from different locations and send them over sftp/ssh to a new location inside an basedir.

Example

var vsftp = require('virtual-sftp');
var sync = new vsftp({
    host: 'localhost',
    username: 'myuser',
    password: 'mysecret',
    remoteDir: '/mybase',
    tryKeyboard: true
});

sync
    // -> /mybase/myfolder
    .addPath('/myfolder') 
    
    // -> /mybase/renamedfolder
    .addPath('/somewhere/myfolder2', 'renamedfolder') 
    
    // -> /mybase/newfolder/renamedfolder
    .addPath('/somewhere/myfolder3', 'newfolder/renamedfolder')
    
    // -> Same as previous line
    .addPath('/somewhere/myfolder3', '/newfolder/renamedfolder') 
    
    // -> /mybase
    .addPath('/somewhere/myfolder4', '/') 
    
    // -> /mybase/myfile
    .addPath('/home/myuser/myfile') 
    
    // -> /mybase/renamedfile
    .addPath('/home/myuser/somewhere/myfile1', 'renamedfile') 
    
    // -> /mybase/newfolder/renamedfile
    .addPath('/home/myuser/somewhere/myfile2', 'newfolder/renamedfile') 

    .on('connect', function() {
        console.log('Connected');
    })
    .on('error', function(error) {
        console.log(error);
    })
    .on('progress', function(progress) {
        console.log('Progress', progress.src, progress.relative, progress.target, progress.percent);
    })
    .on('complete', function(tree) {
        console.log('Completed. Expected Filestructure is: ', tree);
    })
    .upload();

Example with Sync

Remote Machine

var fasthash = require('fasthash');
fasthash.directory('/mybase', function(hashes) {
    // Send to server
});

Server

var vsftp = require('virtual-sftp');
var sync = new vsftp({
    host: 'localhost',
    username: 'myuser',
    password: 'mysecret',
    remoteDir: '/mybase',
    tryKeyboard: true
});

sync
    .addChecksum(hashes)
    .addPath('/myfolder', 'my/crazy/path')
    .upload();

Current Tags

  • 1.0.1                                ...           latest (2 months ago)

2 Versions

  • 1.0.1                                ...           2 months ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 13
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |