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 - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

10

lib/jsftp.js

@@ -481,4 +481,10 @@ /*

var doPasv = function(err, res) {
if (err || res.code !== 227)
return callback(res.text);
if (err || !res || res.code !== 227) {
if (res && res.text)
return callback(new Error(res.text));
else if (err)
return callback(err);
else
return callback(new Error("Unknown error when trying to get into PASV mode"));
}

@@ -485,0 +491,0 @@ // Executes the next passive call, if there are any.

2

package.json
{
"name": "jsftp",
"id": "jsftp",
"version": "0.4.3",
"version": "0.4.4",
"description": "A sane FTP client implementation for NodeJS",

@@ -6,0 +6,0 @@ "keywords": [ "ftp", "protocol", "files", "server", "client", "async" ],

@@ -37,2 +37,4 @@ jsftp [![Build Status](https://secure.travis-ci.org/sergi/jsftp.png)](http://travis-ci.org/sergi/jsftp)

```javascript
var Ftp = require("jsftp");
// Initialize some common variables

@@ -44,41 +46,36 @@ var user = "johndoe";

host: "myhost.com",
port: 21, // The port defaults to 21, but let's include it anyway.
user: user,
port: 3334, // The port defaults to 21
pass: pass
});
// First, we authenticate the user
ftp.auth(user, pass, function(err, res) {
if (err) throw err;
// Retrieve a file in the remote server. When the file has been retrieved,
// the callback will be called with `data` being the Buffer with the
// contents of the file.
// Retrieve a file in the remote server. When the file has been retrieved,
// the callback will be called with `data` being the Buffer with the
// contents of the file.
// `ftp.get` is a convenience method. In this case, it hides the actual
// complexity of setting up passive mode and retrieving files.
ftp.get("/folder/file.ext", function(err, data) {
if (err)
console.error(err);
// This is a convenience method that hides the actual complexity of setting
// up passive mode and retrieving files.
// Do something with the buffer
doSomething(data);
ftp.get("/folder/file.ext", function(err, data) {
if (err) throw err;
// We can use raw FTP commands directly as well. In this case we use FTP
// 'QUIT' method, which accepts no parameters and returns the farewell
// message from the server
ftp.raw.quit(function(err, res) {
if (err)
console.error(err);
// Do something with the buffer
doSomething(data);
// We can use raw FTP commands directly as well. In this case we use FTP
// 'QUIT' method, which accepts no parameters and returns the farewell
// message from the server
ftp.raw.quit(function(err, res) {
if (err) throw err;
console.log("FTP session finalized! See you soon!");
});
console.log("FTP session finalized! See you soon!");
});
});
// The following code assumes that you have authenticated the user, just like
// I did in the code above.
// Create a directory
ftp.raw.mkd("/example_dir", function(err, data) {
if (err)
throw err;
console.error(err);

@@ -91,3 +88,3 @@ console.log(data.text);

if (err)
throw err;
console.error(err);

@@ -98,3 +95,3 @@ console.log(data.text);

You can find more usage examples in the unit tests for it. This documentation
You can find more usage examples in the [unit tests](https://github.com/sergi/jsftp/blob/master/test/jsftp_test.js). This documentation
will grow as jsftp evolves.

@@ -178,5 +175,5 @@

To run the tests from the command line:
To run the tests:
node test/jsftp_test.js
npm test

@@ -183,0 +180,0 @@ Please note that for now the unit tests require python because the FTP server

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