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

basic-ftp

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-ftp - npm Package Compare versions

Comparing version 4.6.4 to 4.6.5

4

CHANGELOG.md
# Changelog
## 4.6.5
- Fixed: Only use MLSD after querying support for feature. (#187)
## 4.6.4

@@ -4,0 +8,0 @@

8

dist/Client.d.ts

@@ -38,9 +38,3 @@ /// <reference types="node" />

parseList: RawListParser;
/**
* Multiple commands to retrieve a directory listing are possible. This instance
* will try all of them in the order presented the first time a directory listing
* is requested. After that, `availableListCommands` will hold only the first
* entry that worked.
*/
availableListCommands: string[];
availableListCommands: readonly string[];
/** Low-level API to interact with FTP server. */

@@ -47,0 +41,0 @@ readonly ftp: FTPContext;

@@ -23,2 +23,4 @@ "use strict";

const fsUnlink = util_1.promisify(fs_1.unlink);
const LIST_COMMANDS_DEFAULT = ["LIST -a", "LIST"];
const LIST_COMMANDS_MLSD = ["MLSD", "LIST -a", "LIST"];
/**

@@ -34,9 +36,3 @@ * High-level API to interact with an FTP server.

constructor(timeout = 30000) {
/**
* Multiple commands to retrieve a directory listing are possible. This instance
* will try all of them in the order presented the first time a directory listing
* is requested. After that, `availableListCommands` will hold only the first
* entry that worked.
*/
this.availableListCommands = ["MLSD", "LIST -a", "LIST"];
this.availableListCommands = LIST_COMMANDS_DEFAULT;
this.ftp = new FtpContext_1.FTPContext(timeout);

@@ -188,6 +184,13 @@ this.prepareTransfer = this._enterFirstCompatibleMode([transfer_1.enterPassiveModeIPv6, transfer_1.enterPassiveModeIPv4]);

async useDefaultSettings() {
const features = await this.features();
// Use MLSD directory listing if possible. See https://tools.ietf.org/html/rfc3659#section-7.8:
// "The presence of the MLST feature indicates that both MLST and MLSD are supported."
const supportsMLSD = features.has("MLST");
this.availableListCommands = supportsMLSD ? LIST_COMMANDS_MLSD : LIST_COMMANDS_DEFAULT;
await this.send("TYPE I"); // Binary mode
await this.sendIgnoringError("STRU F"); // Use file structure
await this.sendIgnoringError("OPTS UTF8 ON"); // Some servers expect UTF-8 to be enabled explicitly
await this.sendIgnoringError("OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;"); // Make sure MLSD listings include all we can parse
if (supportsMLSD) {
await this.sendIgnoringError("OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;"); // Make sure MLSD listings include all we can parse
}
if (this.ftp.hasTLS) {

@@ -218,5 +221,5 @@ await this.sendIgnoringError("PBSZ 0"); // Set to 0 for TLS

if (useExplicitTLS) {
const secureOptions = (_a = options.secureOptions) !== null && _a !== void 0 ? _a : {};
// Fixes https://github.com/patrickjuchli/basic-ftp/issues/166 by making sure
// host is set for any future data connection as well.
const secureOptions = (_a = options.secureOptions) !== null && _a !== void 0 ? _a : {};
secureOptions.host = (_b = secureOptions.host) !== null && _b !== void 0 ? _b : options.host;

@@ -223,0 +226,0 @@ await this.useTLS(secureOptions);

{
"name": "basic-ftp",
"version": "4.6.4",
"version": "4.6.5",
"description": "FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.",

@@ -41,3 +41,3 @@ "main": "dist/index",

"@types/mocha": "8.2.2",
"@types/node": "14.14.35",
"@types/node": "14.14.36",
"@typescript-eslint/eslint-plugin": "4.19.0",

@@ -44,0 +44,0 @@ "@typescript-eslint/parser": "4.19.0",

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