You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ftp-tail

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ftp-tail

A lightweight module to tail files over FTP or SFTP.

2.1.1
latest
Source
npmnpm
Version published
Weekly downloads
91
121.95%
Maintainers
0
Weekly downloads
 
Created
Source

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 and SFTP servers provided by most hosts - ftp-tail is the outcome of this and we have opened-sourced it for others to benefit from.

Usage

FTP

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();
})();

SFTP

import { SFTPTail } from 'ftp-tail';

(async () => {
  // Initiate FTPTail...
  const tailer = new SFTPTail(
    {
      ftp: {
        // ssh2-sftp-client's .connect options.
        host: "xxx.xxx.xxx.xxx",
        username: "user",
        password: "password",
      },

      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.

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts