New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.7.1 to 3.8.0

4

CHANGELOG.md
# Changelog
## 3.8.0
- Added: Use `client.append()` to append to an existing file on the FTP server. (#83)
## 3.7.1

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

@@ -162,2 +162,3 @@ /// <reference types="node" />

* Upload data from a readable stream and store it as a file with a given filename in the current working directory.
* If such a file already exists it will be overwritten.
*

@@ -169,2 +170,11 @@ * @param source The stream to read from.

/**
* Upload data from a readable stream and append it to an existing file with a given filename in the current working directory.
* If the file doesn't exist the FTP server should create it.
*
* @param source The stream to read from.
* @param remotePath The path of the existing remote file to append to.
*/
append(source: Readable, remotePath: string): Promise<FTPResponse>;
protected uploadWithCommand(source: Readable, remotePath: string, command: "STOR" | "APPE"): Promise<FTPResponse>;
/**
* Download a file with a given filename from the current working directory

@@ -171,0 +181,0 @@ * and pipe its data to a writable stream. You may optionally start at a specific

@@ -292,2 +292,3 @@ "use strict";

* Upload data from a readable stream and store it as a file with a given filename in the current working directory.
* If such a file already exists it will be overwritten.
*

@@ -298,2 +299,15 @@ * @param source The stream to read from.

async upload(source, remotePath) {
return this.uploadWithCommand(source, remotePath, "STOR");
}
/**
* Upload data from a readable stream and append it to an existing file with a given filename in the current working directory.
* If the file doesn't exist the FTP server should create it.
*
* @param source The stream to read from.
* @param remotePath The path of the existing remote file to append to.
*/
async append(source, remotePath) {
return this.uploadWithCommand(source, remotePath, "APPE");
}
async uploadWithCommand(source, remotePath, command) {
const onError = (err) => this.ftp.closeWithError(err);

@@ -306,3 +320,3 @@ source.once("error", onError);

// and removes the event listener for the source stream too early.
return await upload(this.ftp, this.progressTracker, source, validPath);
return await upload(this.ftp, this.progressTracker, source, command, validPath);
}

@@ -776,6 +790,6 @@ finally {

*/
function upload(ftp, progress, source, remoteFilename) {
function upload(ftp, progress, source, command, remoteFilename) {
const resolver = new TransferResolver(ftp, progress);
const command = "STOR " + remoteFilename;
return ftp.handle(command, (res, task) => {
const fullCommand = `${command} ${remoteFilename}`;
return ftp.handle(fullCommand, (res, task) => {
if (res instanceof Error) {

@@ -782,0 +796,0 @@ resolver.onError(task, res);

10

package.json
{
"name": "basic-ftp",
"version": "3.7.1",
"version": "3.8.0",
"description": "FTP client for Node.js, supports explicit FTPS over TLS, IPv6, Async/Await, and Typescript.",

@@ -40,7 +40,7 @@ "main": "dist/index",

"@types/node": "12.6.8",
"@typescript-eslint/eslint-plugin": "1.12.0",
"@typescript-eslint/parser": "1.12.0",
"eslint": "6.0.1",
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
"eslint": "6.1.0",
"js-yaml": ">=3.13.1",
"mocha": "6.1.4",
"mocha": "6.2.0",
"rimraf": "2.6.3",

@@ -47,0 +47,0 @@ "typescript": "3.5.3"

@@ -124,4 +124,8 @@ # Basic FTP

Upload data from a readable stream and store it as a file with a given filename in the current working directory.
Upload data from a readable stream and store it as a file with a given filename in the current working directory. If such a file already exists it will be overwritten.
`append(readableStream, remoteFilename): Promise<FTPResponse>`
Upload data from a readable stream and append it to an existing file with a given filename in the current working directory. If the file doesn't exist the FTP server should create it.
`download(writableStream, remoteFilename, startAt = 0): Promise<FTPResponse>`

@@ -128,0 +132,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