1.0.6 • Published 1 year ago

sftp-file-listener v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Sftp file watcher

SFTP file watcher monitors the SFTP directory provided and tigger corresponding event. It's easy to start and stop process at any time.

Configuration

  • Install package

    		npm install sftp-file-listener

SampleCode

var watcher = require('./sftp-file-listener');

var sftpConfig = {
    clientName: "<client_name>", // a name string used in error messages
    host: "127.0.0.1",
    port: 22,
    username: "user_name",
    password: "password",
    path: "path_to_listen",
    filetypes: "file_types_filter", //optional
};

async function init() {
    try {
        
        var listener = await watcher.listen(sftpConfig);

        listener.on("init", function (data) {
        console.log(data);
        });

        listener.on("upload", function (data) {
        console.log(data);
        });

        listener.on("error", async function (data) {
        console.log(data);
        });

        // setTimeout(function () {
        //   console.log("calling stop");
        //   listener.emit("stop", true);
        // }, 3000);
    } catch (err) {
        console.log(err.message);
    }
}
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago