Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsftp

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsftp

A sane FTP client implementation for NodeJS

  • 1.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
275K
decreased by-0.11%
Maintainers
1
Weekly downloads
 
Created

What is jsftp?

jsftp is a lightweight FTP client for Node.js that allows you to interact with FTP servers. It supports a variety of FTP operations such as uploading, downloading, renaming, and deleting files, as well as creating and removing directories.

What are jsftp's main functionalities?

Connecting to an FTP server

This code demonstrates how to connect to an FTP server using jsftp. You need to provide the host, username, and password for the FTP server.

const JSFtp = require('jsftp');
const ftp = new JSFtp({
  host: 'ftp.example.com',
  user: 'username',
  pass: 'password'
});
ftp.auth('username', 'password', (err, res) => {
  if (err) return console.error(err);
  console.log('Connected to FTP server');
});

Uploading a file

This code demonstrates how to upload a file from the local filesystem to the FTP server using jsftp.

ftp.put('local/path/to/file.txt', 'remote/path/to/file.txt', err => {
  if (err) return console.error(err);
  console.log('File uploaded successfully');
});

Downloading a file

This code demonstrates how to download a file from the FTP server to the local filesystem using jsftp.

ftp.get('remote/path/to/file.txt', 'local/path/to/file.txt', err => {
  if (err) return console.error(err);
  console.log('File downloaded successfully');
});

Listing files in a directory

This code demonstrates how to list files in a directory on the FTP server using jsftp.

ftp.ls('remote/path/to/directory', (err, res) => {
  if (err) return console.error(err);
  res.forEach(file => {
    console.log(file.name);
  });
});

Deleting a file

This code demonstrates how to delete a file on the FTP server using jsftp.

ftp.raw('DELE', 'remote/path/to/file.txt', (err, res) => {
  if (err) return console.error(err);
  console.log('File deleted successfully');
});

Other packages similar to jsftp

Keywords

FAQs

Package last updated on 07 Sep 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc