2.1.0 • Published 1 year ago

comlog-ftp v2.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
1 year ago

comlog-ftp NPM version Build Status

FTP Client with encoding support

Installation

$ npm install --save comlog-ftp

Usage Simple way

const FTP = require('../dist/client').Client;

(async function() {
	var conn = new Client();

	await conn.connectAsync(21, "localhost");
	console.info('connected!');
	await conn.login('anonymous', 'anonymous@')
	console.info('logged in!');
	await conn.pasv();

	var res = await conn.list();
	console.info(res);

	await conn.quit();
})();

Usage Adwanced way

const FTP = require('../dist/client').Client;

(async function() {
	var conn = new Client();
	await conn.connectAsync(21, "localhost");

	conn.on('error', function(err) {
		console.error(err);
	});

    // Optional custom data handling
	conn.on('data', function(data) {
		// custom socket data handling
	});

	// Optional custom code 220 handling (all ftp codes can be used)
	this.on('220', function (chunk) {
		this.write('USER ' + this.user, function(){});
	});

	conn.get('/some_filename.txt', 'c:\\some_filename.txt')
        .then(function() {
            console.info('Download Success!');
        })
        .catch(function (err) {
			console.error(err);
		})
    ;
	
	// OR
	conn.raw('ALLO')
        .then(function(response) {
            console.info(response);
        })
        .catch(function (err) {
			console.error(err);
		})
    ;
	
	await conn.quit();
})();

Functions

  • connect( callback ) void
  • write( command, callback ) void
  • raw( command, args, callback ) void
  • feat( callback ) void
  • list( callback ) void
  • get( removeFilePath, localFilePath, callback ) void
  • put( localFilePath, removeFilePath, callback ) void
  • cwd( remotePath, callback ) void
  • pwd( callback ) void
  • rename( remoteFromPath, remoteToPath, callback) void
  • delete( remoteFilePath, callback ) void
  • mkdir( remotePath, callback ) void
  • rmdir( remoteDir, callback ) void
  • stat( callback ) void
  • destroy() void

Properties

  • {int} port Default: 21
  • {String} host Default: "localhost"
  • {boolean} active Default: true
  • {int} timeout Default: 10 60 1000
  • {String} type Default: 'I'
  • {boolean} debug Default: false

CHANGELOG

  • New Promise based FTP Client

License

ISC © COMLOG GmbH

2.0.9

1 year ago

2.1.0

1 year ago

1.3.6

2 years ago

1.3.5

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

1.3.4

3 years ago

1.3.3

4 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.9

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

0.0.1

6 years ago