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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ftp-for-node

v1.0.1

Published

A basic ftp client and server for nodejs that helps to make the transfer of files easier.

Downloads

5

Readme

Ftp-For-Node

A basic Ftp and Explicit FTPS client and server for nodejs that helps to make the transfer of files easier.

To Install

npm install --save ftp-for-node

Examples

Client


//Import
const FtpClient = require("ftp-for-node/client");
const ftp = new FtpClient();

//Specify the available port for data-channel
ftp.dataChannel.port = 3000;

//For RETR
ftp.localSite = "E:\\project\\ftp-for-node\\";

//For Authorization - optional for anonymous
ftp.user = "abc";
ftp.password = "123";

//"connect" - Listener
ftp.on("connect",(code,msg)=>{
    console.log(code,msg);
    ftp.PORT("127,0,0,1,11,184",(err,msg)=>{
        console.log(err,msg);
    })
    ftp.PWD((err,pwd)=>{
        console.log(err,pwd);
    })
    ftp.LIST(null,(err,msg)=>{
        console.log(err,msg)
    })
    ftp.QUIT((err,msg)=>{
        console.log(err,msg);
    })

})

//Init Client
ftp.connect();

Server


//Import 
const FtpServer = require("ftp-for-node/server");

const server = new FtpServer();

//Mandatory-in case no userDetails exists - anonymous
server.defaultPWD = "E:/nodefiles";

//Array of users who can access - authorized use
server.userDetails = [{name:"abc",password:"123",pwd:"pathname to the folder"}];

//Init
server.initiateFtpServer();

Client Features

The client supports properties like :

Specify the available port for data-channel

  1. ftp.dataChannel.port = "number"

For local file reference

  1. ftp.localSite = "absolute pathname";

For Authorization - optional for anonymous

  1. ftp.user = "string";
  2. ftp.password = "string";

For AUTH

  1. ftp.secureOptions.key = fs.readFileSync('key.pem');
  2. ftp.secureOptions.cert = fs.readFileSync('cert.pem');

Control Channel port and address

  1. port = "number"
  2. address = "string"

How to Use the methods ?

Format :
    FtpClient.method([arg],calback:function(err,msg))

The client supports methods like :

PORT("h1,h2,h3,h4,h5,p1,p2",callback(err,msg))

To send the port number of data-channel for active mode.

PASV(callback(err,msg))

Convert to passive mode

LIST([pathname|null],callback(err,msg))

To list the files in PWD

NSLT([pathname|null],callback(err,msg))

To list the file name in PWD

STOR(pathname,callback(err,msg))

To Store the local files in server

RETR(pathname,callback(err,msg))

To retrieve files from server

APPE(pathname,callback(err,msg))

To Append the local files in server

STOU(pathname,callback(err,msg))

To Store with unique name the local files in server

RMD(pathname,callback(err,msg))

Remove folder

MKD(pathname,callback(err,msg))

Make folder

CWD(pathname,callback(err,msg))

Change wprking directory

PWD(callback(err,msg))

Return present directory name

TYPE(["I"|"A"],callback(err,msg))

Change Type

SYST(callback(err,msg))

Return System info

STAT([string|null],callback(err,msg))

Return Current State

QUIT(callback(err,msg))

Close Control Channel

AUTH('tls',callback(err,msg))

Explicit Security using TLS

Server Features

The client supports properties like :

The authorized user details - Optional

  1. userDetails = [{name:"string" , password:"string" , pwd:[string] }...]

The local connection details for control channel

  1. localPort = "number" | default : 21
  2. localAddress = "string" | default : localhost

Passive connection details

  1. passive = { active : "boolean" | default : true , address : "string" | default : "127.0.0.1" , port : "number" | default : 40000 }

For AUTH

  1. ftp.secureOptions.key = fs.readFileSync('key.pem');
  2. ftp.secureOptions.cert = fs.readFileSync('cert.pem');

For anonymous users - mandatory

  1. defaultPWD = "string"

TO INIT

initiateFtpServer()