A big commit with a bunch of node modules so I could run puppeteer for Walmart. Added some todos and Headway's templates.

This commit is contained in:
Norm Rasmussen
2024-02-28 17:13:10 -05:00
parent dbcdfc8472
commit 1184fe0cd1
1107 changed files with 76526 additions and 8934 deletions

View File

@ -4,7 +4,7 @@
[![npm downloads](https://img.shields.io/npm/dw/basic-ftp)](https://www.npmjs.com/package/basic-ftp)
[![Node.js CI](https://github.com/patrickjuchli/basic-ftp/actions/workflows/nodejs.yml/badge.svg)](https://github.com/patrickjuchli/basic-ftp/actions/workflows/nodejs.yml)
This is an FTP client library for Node.js. It supports FTPS over TLS, Passive Mode over IPv6, has a Promise-based API, and offers methods to operate on whole directories.
This is an FTP client library for Node.js. It supports FTPS over TLS, Passive Mode over IPv6, has a Promise-based API, and offers methods to operate on whole directories. Active Mode is not supported.
## Advisory
@ -23,13 +23,13 @@ Node 10.0 or later is the only dependency.
The first example will connect to an FTP server using TLS (FTPS), get a directory listing, upload a file and download it as a copy. Note that the FTP protocol doesn't allow multiple requests running in parallel.
```js
const ftp = require("basic-ftp")
// ESM: import * as ftp from "basic-ftp"
const { Client } = require("basic-ftp")
// ESM: import { Client } from "basic-ftp"
example()
async function example() {
const client = new ftp.Client()
const client = new Client()
client.ftp.verbose = true
try {
await client.access({

View File

@ -36,7 +36,7 @@ export interface UploadOptions {
export declare class Client {
prepareTransfer: TransferStrategy;
parseList: RawListParser;
availableListCommands: readonly string[];
availableListCommands: string[];
/** Low-level API to interact with FTP server. */
readonly ftp: FTPContext;
/** Tracks progress of data transfers. */

View File

@ -20,8 +20,8 @@ const fsStat = (0, util_1.promisify)(fs_1.stat);
const fsOpen = (0, util_1.promisify)(fs_1.open);
const fsClose = (0, util_1.promisify)(fs_1.close);
const fsUnlink = (0, util_1.promisify)(fs_1.unlink);
const LIST_COMMANDS_DEFAULT = ["LIST -a", "LIST"];
const LIST_COMMANDS_MLSD = ["MLSD", "LIST -a", "LIST"];
const LIST_COMMANDS_DEFAULT = () => ["LIST -a", "LIST"];
const LIST_COMMANDS_MLSD = () => ["MLSD", "LIST -a", "LIST"];
/**
* High-level API to interact with an FTP server.
*/
@ -32,7 +32,7 @@ class Client {
* @param timeout Timeout in milliseconds, use 0 for no timeout. Optional, default is 30 seconds.
*/
constructor(timeout = 30000) {
this.availableListCommands = LIST_COMMANDS_DEFAULT;
this.availableListCommands = LIST_COMMANDS_DEFAULT();
this.ftp = new FtpContext_1.FTPContext(timeout);
this.prepareTransfer = this._enterFirstCompatibleMode([transfer_1.enterPassiveModeIPv6, transfer_1.enterPassiveModeIPv4]);
this.parseList = parseList_1.parseList;
@ -182,7 +182,7 @@ class Client {
// 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;
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 and setting before login might not have worked.

View File

@ -159,7 +159,7 @@ export declare class FTPContext {
*/
protected _closeControlSocket(): void;
/**
* Close a socket. Sends FIN and ignores any error.
* Close a socket, ignores any error.
* @protected
*/
protected _closeSocket(socket: Socket | undefined): void;

View File

@ -329,16 +329,14 @@ class FTPContext {
this._closeSocket(this._socket);
}
/**
* Close a socket. Sends FIN and ignores any error.
* Close a socket, ignores any error.
* @protected
*/
_closeSocket(socket) {
if (socket) {
this._removeSocketListeners(socket);
socket.on("error", doNothing);
socket.on("timeout", () => socket.destroy());
socket.setTimeout(this.timeout);
socket.end();
socket.destroy();
}
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "basic-ftp",
"version": "5.0.4",
"version": "5.0.5",
"description": "FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.",
"main": "dist/index",
"types": "dist/index",
@ -9,8 +9,9 @@
],
"scripts": {
"prepublishOnly": "npm run clean && npm run lint && tsc && mocha",
"prepare": "tsc",
"test": "npm run prepublishOnly",
"clean": "rimraf dist",
"clean": "rm -rf dist",
"lint": "eslint \"./src/**/*.ts\"",
"lint-fix": "eslint --fix \"./src/**/*.ts\"",
"dev": "npm run clean && tsc --watch",
@ -43,7 +44,6 @@
"@typescript-eslint/parser": "6.14.0",
"eslint": "8.55.0",
"mocha": "10.2.0",
"rimraf": "5.0.5",
"typescript": "5.3.3"
}
}