3.1.7 • Published 9 months ago

comlog-ftp v3.1.7

Weekly downloads
2
License
ISC
Repository
github
Last release
9 months 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

3.1.7

9 months ago

3.1.3

10 months ago

3.1.2

10 months ago

3.1.0

10 months ago

3.1.6

10 months ago

3.1.5

10 months ago

3.1.4

10 months ago

3.0.4

10 months ago

3.0.3

10 months ago

3.0.2

10 months ago

3.0.8

10 months ago

3.0.7

10 months ago

3.0.5

10 months ago

3.0.0

10 months ago

2.0.9

2 years ago

2.1.0

2 years ago

1.3.6

4 years ago

1.3.5

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.8

4 years ago

2.0.1

4 years ago

1.3.4

5 years ago

1.3.3

6 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.9

8 years ago

1.2.8

8 years ago

1.2.7

8 years ago

1.2.6

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.9

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

0.0.1

8 years ago