ftp client 구현 샘플

 

Installation 

shell> npm install ftp-client

 

Code Example

var ftpClient = require('ftp-client'),
    config = {
        host: 'localhost',
        port: 21,
        user: 'anonymous',
        password: 'anonymous@'
    },
    options = {
        logging: 'basic'
    },
    client = new ftpClient(config, options);
 
client.connect(function () {
 
    client.upload(['test/**'], '/public_html/test', {
        baseDir: 'test',
        overwrite: 'older'
    }, function (result) {
        console.log(result);
    });
 
    client.download('/public_html/test2', 'test2/', {
        overwrite: 'all'
    }, function (result) {
        console.log(result);
    });
 
});

 

 

 

 

 

 

 

 

 

출처 : https://www.npmjs.com/package/ftp-client

 

ftp-client

A wrapper for the node-ftp module. Latest version: 0.2.2, last published: 7 years ago. Start using ftp-client in your project by running `npm i ftp-client`. There are 17 other projects in the npm registry using ftp-client.

www.npmjs.com