@acteam-it/sftp-watcher 中文文档教程

发布于 4年前 浏览 8 项目主页 更新于 3年前

Sftp-watcher

    SSFTP watcher helps to monitor the SFTP directory and tigger corresponding event. It's easy to start and stop process at any time.

Configuration

  • 安装包

    npm install sftp-watcher
    

SampleCode

var SftpWatcher = require("sftp-watcher");                            

var event = new SftpWatcher({
        host : 'your.hostname.com',
        port : 22,
        username : 'username',
        password : 'password',
        path : 'test/'
    });

event.on("upload", function (data) {
    console.log(data)
});
event.on("delete", function (data) {
    console.log(data)
});
event.on("heartbeat", function (data) {
    console.log(data.toString())
});
event.on("close", function (data) {
    console.log(data.toString())
});
event.on("error", function (data) {
    console.log(data.toString())
});

/*To stop the watcher*/

event.emit("stop");

Sftp-watcher

    SSFTP watcher helps to monitor the SFTP directory and tigger corresponding event. It's easy to start and stop process at any time.

Configuration

  • install package

    npm install sftp-watcher
    

SampleCode

var SftpWatcher = require("sftp-watcher");                            

var event = new SftpWatcher({
        host : 'your.hostname.com',
        port : 22,
        username : 'username',
        password : 'password',
        path : 'test/'
    });

event.on("upload", function (data) {
    console.log(data)
});
event.on("delete", function (data) {
    console.log(data)
});
event.on("heartbeat", function (data) {
    console.log(data.toString())
});
event.on("close", function (data) {
    console.log(data.toString())
});
event.on("error", function (data) {
    console.log(data.toString())
});

/*To stop the watcher*/

event.emit("stop");
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文