2.0.1 • Published 3 years ago

ftp-tail v2.0.1

Weekly downloads
124
License
MIT
Repository
github
Last release
3 years ago

ftp-tail

GitHub release GitHub contributors GitHub release

GitHub issues GitHub pull requests GitHub issues

About

Need to tail a file on a remote server? ftp-tail should be able to help!

Motivation

To collect the data we needed to build SquadJS, a scripting framework for Squad servers, we found we needed to tail the Squad server's log files. As a result of this, it became a requirement that SquadJS must be installed on the same machine as the Squad server, however, this prevented anyone using rented Squad server instances from using SquadJS. Thus, we endeavoured to make it possible for these logs files to be streamed over the FTP servers provided by most hosts - ftp-tail is the outcome of this and we have opened-sourced it for others to benefit from.

Usage

import FTPTail from 'ftp-tail';

(async () => {
  // Initiate FTPTail...
  const tailer = new FTPTail(
    {
      ftp: {
        // basic-ftp's .access options.
        host: "xxx.xxx.xxx.xxx",
        user: "user",
        password: "password",
        
        // As well as...
        timeout: 5 * 1000, // Timeout (optional).
        encoding: 'utf8' // Encoding (optional).
      },

      fetchInterval: 0, // Delay between polls.
      log: true // Enable logging (also accepts logging function).
    }
  );

  // Do something with the lines, e.g. log them.
  tailer.on('line', console.log);

  // Watch the file...
  await tailer.watch('/SquadGame.log');
  
  // Unwatch the file...
  await tailer.unwatch();
})();

Credits

The logic behind ftp-tail was originally proposed, designed and implemented by awn.gg - ftp-tail is an open-sourced re-implementation of their efforts.

2.0.1

3 years ago

2.0.0

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago