1.0.4 • Published 4 years ago

sftp-async v1.0.4

Weekly downloads
18
License
ISC
Repository
github
Last release
4 years ago

SFTP-Async

This package contains asynchronous helper methods to make using SFTP with the SSH2 package easier.

Usage

To initialize an sftp connection, simply include the package and then call connect with your server settings. Once connected, you can run the other methods (shown below).

  const sftpa = require('sftp-async');

  await sftpa.connect('2.2.2.2', 22, 'username', 'password');

  const dirlist = await sftpa.readdir('/upload');
  const [file] = dirlist;
  const content = await sftpa.getFileData(`/upload/${file.filename}`);

  await sftpa.move(`/upload/${file.filename}`, `/processed/${file.filename}`);
  await sftpa.disconnect();

Tests

There's a very basic test suite included. Rename test.config.example.js to test.config.js and change the settings to match your SFTP server. Drop a file in the source directory and then run the tests.

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago