npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ftp-management-queue

v5.7.1

Published

Queue Management for FTP Server

Downloads

7

Readme

ftp-management-queue

File Queue Management for FTP/SFTP Server

const kue = require('kue');
let queue = kue.createQueue()
/*Add your processing file code snippet according to your requirement*/
const processFile = (params, cb) => {

  /*
   params = {
    fileName:<>,
    filePath:<>,
   }
  */
  if (!this.job) {
    this.job = {
      log() {
        console.log(arguments);
      }
    };
  }
  let i = 0;
  let intervalObject = setInterval(()=>{
    this.job.log(i++)
  },1000)
  setTimeout(function(){
    clearInterval(intervalObject)
    cb()
  },10000)
};

const options = {
  queue,
  fileFormats: [".csv"], //.csv,.xml,.xlsx
  numberOfProcess: {
    itemsManagerProcess: 1,//concurrency to monitor brand ftp server at a time for newly uploaded file
    fileBatchProcess: 1, //number of file process at a time
  },
  processNames:{
     manager:'manager-queue',//queue name for manager process
     processor:'processor-queue',//queue name for file processor process
  },
  items: [
    {
      id: "1",
      name: "Brand1",
      priority: "normal",//normal,high,medium
      // this used only when file format is xml to determine from which parent tag read the data
      type:'ftp',//ftp/sftp
      ftp: {
        host: "localhost",
        port: 21,
        user: "user",
        password: "password",
      },
      dir: {
        upload: "/path/to/upload/dir",
        enqueued: "/path/to/enqueued/dir",
        processing: "/path/to/processing/dir",
        error: "/path/to/error/dir",
        processed: "/path/to/processed/dir",
        backup: "/path/to/backup/dir"
      }
    }
  ],
  customCallback: processFile,
  filePath: __dirname
};

#initialize uploader queue
const FtpManagementQueue = require('ftp-management-queue')
FtpManagementQueue(options)

How File Queue Management works?

  1. Manager Queue - Monitor for new files in upload dir from multiple FTP server which we've defined in items and add those file file processor Queue, while doing it he'll move this file to enqueued dir

    • Move file from upload dir to enqueued dir
  2. Processor Queue - Process the file using customCallback function given by user.

    • Move file from enqueued to processing dir
    • Execute customCallback function on file
    • Once done move this file to processed dir , also move the original file to backup dir
    • If you pass updated file path to callback function then updated file will go to processed dir and original file will go to backup dir
  3. We can define , how many Manager Queue and Processor Queue can parallely run in options

numberOfProcess: {
  itemsManagerProcess: 1,//concurrency to monitor brand ftp server at a time for newly uploaded file
  fileBatchProcess: 1, //number of file process at a time
  emailProcess: 2 // concurrency for sending email
}