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

ftps-promise

v0.1.1

Published

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.

Readme

node-ftps-promise

Fork of node-ftps using available ES6 in node 4.2.1 and Promises

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.

Requirements

You need to have the executable lftp installed on your computer.

LFTP Homepage

LFTP For Windows

Installation

npm install ftps

Usage

var FTPS = require('ftps');
var ftps = FTPS({
  host: 'domain.com', // required
  username: 'Test', // required
  password: 'Test', // required
  protocol: 'sftp', // optional, values : 'ftp', 'sftp', 'ftps',... default is 'ftp'
  // protocol is added on beginning of host, ex : sftp://domain.com in this case
  port: 22, // optional
  // port is added to the end of the host, ex: sftp://domain.com:22 in this case
  escape: true, // optional, used for escaping shell characters (space, $, etc.), default: true
  retries: 2, // Optional, defaults to 1 (1 = no retries, 0 = unlimited retries)
  timeout: 10,
  requiresPassword: true, // Optional, defaults to true
  autoConfirm: true, // Optional, is used to auto confirm ssl questions on sftp or fish protocols, defaults to false
  cwd: '' // Optional, defaults to the directory from where the script is executed 
});
// Do some amazing things
ftps.cd('some_directory').addFile(__dirname + '/test.txt').then(console.log);

Some documentation

Here are some of the chainable functions :

ftps.ls()
ftps.pwd()
ftps.cd(directory)
ftps.cat(pathToRemoteFiles)
ftps.put(pathToLocalFile, [pathToRemoteFile]) // alias: addFile
ftps.get(pathToRemoteFile, [pathToLocalFile]) // download remote file and save to local path (if not given, use same name as remote file), alias: getFile
ftps.mv(from, to) // alias move
ftps.rm(file1, file2, ...) // alias remove
ftps.rmdir(directory1, directory2, ...)

If you want to escape some arguments because you used "escape: false" in the options:

ftps.escapeshell('My folder');
// Return 'My\\ \\$folder'

Execute a command on the remote server:

ftps.raw('ls -l')

To see all available commands: LFTP Commands

For information, ls, pwd, ... rm are just some alias of raw() method.

Run the commands

ftps.exec().then(res => {
  // res is an hash with { error: stderr, data: stdout }
});
// exec() return a promise

Also, take note that if a command fails it will not stop the next commands from executing, for example:

ftps.cd('non-existing-dir/').addFile('./test.txt').then(console.log);
/*
Will add file on ~/ and give:
{
  error: 'cd: non-existing-dir: No such file or directory\n',
  data: ''
}
So...be cautious because ./test.txt has been added
*/

Why?

Because I wantded to be able to compose it with promises and wanted methods to be first-class, so avoid the hassle of prototype.